Implementing PubPub initial minimal grammar for dealing with alternate link notation.
This commit is contained in:
parent
9a3d17e200
commit
70a06b2c4d
@ -24,6 +24,14 @@ Markdeep class >> fromMarkdownFile: aFileReference [
|
||||
^ self new fromMarkdownFile: aFileReference.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep class >> fromPubPubTOC: orderedDictionary folder: folder index: ordinalPossitive [
|
||||
| contentSection testFile |
|
||||
contentSection := orderedDictionary associations at: ordinalPossitive.
|
||||
testFile := folder / (contentSection key,'--', contentSection value),'md'.
|
||||
^ self new fromMarkdownFile: testFile.
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
Markdeep >> authors [
|
||||
self metadata at: 'authors' ifPresent: [:k | ^ '**', k, '**' ].
|
||||
@ -123,7 +131,7 @@ Markdeep >> contents [
|
||||
Markdeep >> exportAsFile [
|
||||
| newFile |
|
||||
self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ].
|
||||
newFile := (self markdownFile fullName, '.html') asFileReference.
|
||||
newFile := (self markdownFile file fullName, '.html') asFileReference.
|
||||
self exportAsFileOn: newFile.
|
||||
]
|
||||
|
||||
|
@ -28,7 +28,8 @@ MiniDocs class >> installYamlToJson [
|
||||
|
||||
{ #category : #accessing }
|
||||
MiniDocs class >> yamlToJson: yamlString [
|
||||
|
||||
"This method uses a external binary written in Nim, as the native Pharo parser for YAML, written in PetitParser,
|
||||
was less robust and unable to parse correctly the same strings as the external one."
|
||||
self yamlToJsonBinary exists ifFalse: [ self installYamlToJson ].
|
||||
|
||||
OSSUnixSubprocess new
|
||||
|
45
src/MiniDocs/PubPubGrammar.class.st
Normal file
45
src/MiniDocs/PubPubGrammar.class.st
Normal file
@ -0,0 +1,45 @@
|
||||
Class {
|
||||
#name : #PubPubGrammar,
|
||||
#superclass : #PP2CompositeNode,
|
||||
#instVars : [
|
||||
'document',
|
||||
'link',
|
||||
'linkLabel',
|
||||
'linkContent'
|
||||
],
|
||||
#category : #'MiniDocs-Model'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubGrammar >> document [
|
||||
^ link islandInSea star
|
||||
]
|
||||
|
||||
{ #category : #links }
|
||||
PubPubGrammar >> link [
|
||||
^ linkLabel, linkContent ==> #second
|
||||
]
|
||||
|
||||
{ #category : #links }
|
||||
PubPubGrammar >> linkContent [
|
||||
| content |
|
||||
content := ($} asPParser not) star flatten.
|
||||
^ ${ asPParser, content, $} asPParser
|
||||
]
|
||||
|
||||
{ #category : #links }
|
||||
PubPubGrammar >> linkLabel [
|
||||
| label |
|
||||
label := ($] asPParser not) star flatten.
|
||||
^ $[ asPParser, label, $] asPParser
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubGrammar >> linkSea [
|
||||
^ link sea ==> #second
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubGrammar >> start [
|
||||
^ document
|
||||
]
|
Loading…
Reference in New Issue
Block a user