Creating a parser for HedgeDoc youtube embedded links.
This commit is contained in:
parent
c8c50288cf
commit
6eada9fe00
19
src/MiniDocs/HedgeDocGrammar.class.st
Normal file
19
src/MiniDocs/HedgeDocGrammar.class.st
Normal file
@ -0,0 +1,19 @@
|
||||
Class {
|
||||
#name : #HedgeDocGrammar,
|
||||
#superclass : #PP2CompositeNode,
|
||||
#instVars : [
|
||||
'youtubeEmbeddedLink'
|
||||
],
|
||||
#category : #'MiniDocs-Model'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDocGrammar >> start [
|
||||
^ #any asPParser starLazy
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDocGrammar >> youtubeEmbeddedLink [
|
||||
"I parse a youtube embedded link in a hedgedoc document."
|
||||
^ '{%youtube' asPParser token trim, #any asPParser starLazy token, '%}' asPParser token trim
|
||||
]
|
15
src/MiniDocs/HedgeDocGrammarTest.class.st
Normal file
15
src/MiniDocs/HedgeDocGrammarTest.class.st
Normal file
@ -0,0 +1,15 @@
|
||||
Class {
|
||||
#name : #HedgeDocGrammarTest,
|
||||
#superclass : #PP2CompositeNodeTest,
|
||||
#category : #'MiniDocs-Model'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDocGrammarTest >> parserClass [
|
||||
^ HedgeDocGrammar
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDocGrammarTest >> testYoutubeEmbeddedLink [
|
||||
^ self parse: '{%youtube U7mpXaLN9Nc %}' rule: #youtubeEmbeddedLink
|
||||
]
|
Loading…
Reference in New Issue
Block a user