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.
|
^ 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' }
|
{ #category : #'instance creation' }
|
||||||
Markdeep >> authors [
|
Markdeep >> authors [
|
||||||
self metadata at: 'authors' ifPresent: [:k | ^ '**', k, '**' ].
|
self metadata at: 'authors' ifPresent: [:k | ^ '**', k, '**' ].
|
||||||
@ -123,7 +131,7 @@ Markdeep >> contents [
|
|||||||
Markdeep >> exportAsFile [
|
Markdeep >> exportAsFile [
|
||||||
| newFile |
|
| newFile |
|
||||||
self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ].
|
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.
|
self exportAsFileOn: newFile.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ MiniDocs class >> appFolder [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
MiniDocs class >> installYamlToJson [
|
MiniDocs class >> installYamlToJson [
|
||||||
"For the moment, only Gnu/Linux and Mac are supported.
|
"For the moment, only Gnu/Linux and Mac are supported.
|
||||||
IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation."
|
IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation."
|
||||||
self yamlToJsonBinary exists ifTrue: [ ^ MiniDocs appFolder ].
|
self yamlToJsonBinary exists ifTrue: [ ^ MiniDocs appFolder ].
|
||||||
Nimble install: 'commandeer'.
|
Nimble install: 'commandeer'.
|
||||||
@ -28,7 +28,8 @@ MiniDocs class >> installYamlToJson [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
MiniDocs class >> yamlToJson: yamlString [
|
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 ].
|
self yamlToJsonBinary exists ifFalse: [ self installYamlToJson ].
|
||||||
|
|
||||||
OSSUnixSubprocess new
|
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