Extending PubPubGrammar syntax and test.
This commit is contained in:
parent
77404b9b31
commit
a5fc210776
@ -36,7 +36,9 @@ PubPubGrammar >> imageLinkContent [
|
|||||||
|
|
||||||
{ #category : #links }
|
{ #category : #links }
|
||||||
PubPubGrammar >> imageLinkLabel [
|
PubPubGrammar >> imageLinkLabel [
|
||||||
^ '![' asPParser, #any asPParser starLazy flatten, $] asPParser ==> #second
|
| label |
|
||||||
|
label := ($] asPParser not / #any asPParser) starLazy flatten.
|
||||||
|
^ '![' asPParser, label, $] asPParser ==> #second
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -56,7 +58,9 @@ PubPubGrammar >> linkContent [
|
|||||||
|
|
||||||
{ #category : #links }
|
{ #category : #links }
|
||||||
PubPubGrammar >> linkLabel [
|
PubPubGrammar >> linkLabel [
|
||||||
^ $[ asPParser, #any asPParser starLazy flatten, $] asPParser ==> #second.
|
| label |
|
||||||
|
label := ("$] asPParser not /" #any asPParser) starLazy flatten.
|
||||||
|
^ $[ asPParser, label, $] asPParser ==> #second.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -9,6 +9,13 @@ PubPubGrammarTest >> parserClass [
|
|||||||
^ PubPubGrammar
|
^ PubPubGrammar
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubGrammarTest >> testComposedImageLink [
|
||||||
|
self
|
||||||
|
parse: '![This is an image label with sublinks (bla bl)[blog]](this/is/an/image/link){this are alternate image sizes}'
|
||||||
|
rule: #imageLink
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPubGrammarTest >> testImageLink [
|
PubPubGrammarTest >> testImageLink [
|
||||||
self
|
self
|
||||||
@ -16,9 +23,30 @@ PubPubGrammarTest >> testImageLink [
|
|||||||
rule: #imageLink
|
rule: #imageLink
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubGrammarTest >> testLabel: label [
|
||||||
|
self
|
||||||
|
parse: label
|
||||||
|
rule: #linkLabel
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPubGrammarTest >> testLink [
|
PubPubGrammarTest >> testLink [
|
||||||
self
|
self
|
||||||
parse: '[This is a label]{this/is/a/link}'
|
parse: '[This is a label]{this/is/a/link}'
|
||||||
rule: #link
|
rule: #link
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubGrammarTest >> testNestedLabel [
|
||||||
|
self
|
||||||
|
parse: '[This is a label with [sublabels]]'
|
||||||
|
rule: #linkLabel
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubGrammarTest >> testSimpleLabel [
|
||||||
|
self
|
||||||
|
parse: '[This is a label]'
|
||||||
|
rule: #linkLabel
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user