2023-03-08 21:48:03 +00:00
|
|
|
Class {
|
|
|
|
#name : #HedgeDocGrammar,
|
|
|
|
#superclass : #PP2CompositeNode,
|
|
|
|
#instVars : [
|
|
|
|
'youtubeEmbeddedLink'
|
|
|
|
],
|
2023-04-27 18:36:24 +00:00
|
|
|
#category : #'MiniDocs-Model'
|
2023-03-08 21:48:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
HedgeDocGrammar >> start [
|
2023-03-20 21:37:29 +00:00
|
|
|
| any |
|
|
|
|
any := #any asPParser.
|
2023-03-21 21:13:26 +00:00
|
|
|
^ (self yamlMetadata / any starLazy), youtubeEmbeddedLink
|
2023-03-20 21:37:29 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
HedgeDocGrammar >> yamlMetadata [
|
|
|
|
"I parse the header of the hedgedoc document for YAML metadata."
|
2023-03-21 21:13:26 +00:00
|
|
|
^ '---' asPParser token, #any asPParser starLazy token, '---' asPParser token
|
2023-03-08 21:48:03 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
HedgeDocGrammar >> youtubeEmbeddedLink [
|
2023-03-20 21:37:29 +00:00
|
|
|
"I parse the youtube embedded links in a hedgedoc document."
|
|
|
|
| link linkSea |
|
2023-03-21 21:13:26 +00:00
|
|
|
link := self youtubeEmbeddedLinkOpen,
|
2023-03-22 15:54:16 +00:00
|
|
|
#any asPParser starLazy token,
|
2023-03-21 21:13:26 +00:00
|
|
|
self youtubeEmbeddedLinkClose.
|
|
|
|
linkSea := link islandInSea star.
|
|
|
|
^ linkSea
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
HedgeDocGrammar >> youtubeEmbeddedLinkClose [
|
|
|
|
^ '%}' asPParser token
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
HedgeDocGrammar >> youtubeEmbeddedLinkOpen [
|
|
|
|
^ '{%youtube' asPParser token
|
2023-03-08 21:48:03 +00:00
|
|
|
]
|