43 lines
1017 B
Smalltalk
43 lines
1017 B
Smalltalk
Class {
|
|
#name : #HedgeDocGrammar,
|
|
#superclass : #PP2CompositeNode,
|
|
#instVars : [
|
|
'youtubeEmbeddedLink'
|
|
],
|
|
#category : #'MiniDocs-Model'
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
HedgeDocGrammar >> metadataAsYAML [
|
|
"I parse the header of the hedgedoc document for YAML metadata."
|
|
^ '---' asPParser token, #any asPParser starLazy token, '---' asPParser token
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
HedgeDocGrammar >> start [
|
|
| any |
|
|
any := #any asPParser.
|
|
^ (self metadataAsYAML / any starLazy), youtubeEmbeddedLink
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
HedgeDocGrammar >> youtubeEmbeddedLink [
|
|
"I parse the youtube embedded links in a hedgedoc document."
|
|
| link linkSea |
|
|
link := self youtubeEmbeddedLinkOpen,
|
|
#any asPParser starLazy token,
|
|
self youtubeEmbeddedLinkClose.
|
|
linkSea := link islandInSea star.
|
|
^ linkSea
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
HedgeDocGrammar >> youtubeEmbeddedLinkClose [
|
|
^ '%}' asPParser token
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
HedgeDocGrammar >> youtubeEmbeddedLinkOpen [
|
|
^ '{%youtube' asPParser token
|
|
]
|