diff --git a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st index ea94e0d..961a757 100644 --- a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st +++ b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st @@ -13,19 +13,17 @@ BaselineOfMiniDocs >> baseline: spec [ "Dependencies" spec baseline: 'Mustache' with: [ spec repository: 'github://noha/mustache' ]; + baseline: 'Temple' with: [ spec repository: 'github://astares/Pharo-Temple/src' ]; + baseline: 'Teapot' with: [ spec repository: 'github://zeroflag/Teapot/source' ]; baseline: 'Tealight' with: [ spec repository: 'github://astares/Tealight:main/src' ]; baseline: 'LepiterBuildingBlocs' with: [spec repository: 'github://botwhytho/LepiterBuildingBlocs:main/src']; - baseline: 'PetitParser' with: [ - spec - loads: #('Minimal' 'Core' 'Tests' 'Islands'); - repository: 'github://moosetechnology/PetitParser:v3.x.x/src' - ]. + baseline: 'PetitParser' with: [ spec repository: 'github://moosetechnology/PetitParser:v3.x.x/src' ]. "self fossil: spec." self xmlParserHTML: spec. "Packages" spec package: 'PetitMarkdown' with: [ spec requires: #('PetitParser')]; - package: 'MiniDocs' with: [ spec requires: #('Mustache' 'Tealight' 'PetitMarkdown')]. + package: 'MiniDocs' with: [ spec requires: #('Mustache' 'Temple' 'Teapot' 'Tealight' 'PetitMarkdown')]. "Groups" diff --git a/src/MiniDocs/HedgeDocGrammar.class.st b/src/MiniDocs/HedgeDocGrammar.class.st index f94395a..16e405e 100644 --- a/src/MiniDocs/HedgeDocGrammar.class.st +++ b/src/MiniDocs/HedgeDocGrammar.class.st @@ -8,16 +8,16 @@ Class { } { #category : #accessing } -HedgeDocGrammar >> start [ - | any | - any := #any asPParser. - ^ (self yamlMetadata / any starLazy), youtubeEmbeddedLink +HedgeDocGrammar >> metadataAsYAML [ + "I parse the header of the hedgedoc document for YAML metadata." + ^ '---' asPParser token, #any asPParser starLazy token, '---' asPParser token ] { #category : #accessing } -HedgeDocGrammar >> yamlMetadata [ - "I parse the header of the hedgedoc document for YAML metadata." - ^ '---' asPParser token, #any asPParser starLazy token, '---' asPParser token +HedgeDocGrammar >> start [ + | any | + any := #any asPParser. + ^ (self metadataAsYAML / any starLazy), youtubeEmbeddedLink ] { #category : #accessing } diff --git a/src/MiniDocs/Logseq.class.st b/src/MiniDocs/Logseq.class.st new file mode 100644 index 0000000..c721372 --- /dev/null +++ b/src/MiniDocs/Logseq.class.st @@ -0,0 +1,33 @@ +Class { + #name : #Logseq, + #superclass : #Object, + #instVars : [ + 'folder' + ], + #category : #MiniDocs +} + +{ #category : #accessing } +Logseq >> assets [ + ^ self folder / 'assets' +] + +{ #category : #accessing } +Logseq >> folder [ + ^ folder +] + +{ #category : #accessing } +Logseq >> folder: aFolder [ + folder := aFolder +] + +{ #category : #accessing } +Logseq >> journals [ + self folder / 'journals' +] + +{ #category : #accessing } +Logseq >> pages [ + self folder/ 'pages' +] diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index d320475..f94979c 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -30,9 +30,17 @@ Markdeep class >> fromPubPubTOC: orderedDictionary folder: folder index: ordina ^ self new fromMarkdownFile: testFile. ] +{ #category : #accessing } +Markdeep >> asMarkdown [ + ^ Markdown new + metadata: self metadata; + body: self body; + file: self markdownFile +] + { #category : #'instance creation' } Markdeep >> authors [ - self metadata at: 'authors' ifPresent: [:k | ^ '**', k, '**' ]. + self metadata at: 'authors' ifPresent: [:k | ^ '**', k, '**' ] ifAbsentPut: [ Dictionary new ]. ^ ''. ] @@ -57,6 +65,11 @@ Markdeep >> bodyReplaceAll: original with: replacement [ self body: (self body copyReplaceAll: original with: replacement) ] +{ #category : #accessing } +Markdeep >> cleanMetadata [ + metadata := nil +] + { #category : #accessing } Markdeep >> commentPubPubDelimiters [ | commented openners | @@ -158,6 +171,63 @@ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnote ^ response contents ] +{ #category : #accessing } +Markdeep >> extractTitleFrom: docTree [ + | tempTitle | + tempTitle := ((docTree children + detect: [ :node | node className = 'PPCMIndentedCode' ]) children + detect: [ :subnode | subnode text trimmed beginsWith: '**' ]) text trimmed. + self title: (tempTitle copyFrom: 3 to: tempTitle size - 2). + ^ tempTitle +] + +{ #category : #accessing } +Markdeep >> extractYamlMetadataFrom: documentTree [ + | yamlComment response | + yamlComment := documentTree children + detect: [:node | node className = 'PPCMHtmlBlock' and: [node text trimmed beginsWith: '