From 004b286835918cbf0fc44986db322a194c5a402e Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 3 Mar 2024 18:48:00 -0500 Subject: [PATCH 01/14] Starting importation of Markdeep objects from files. --- src/MiniDocs/Markdeep.class.st | 24 ++++++++++++++++++++++-- src/MiniDocs/Markdown.class.st | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index d320475..1f5feaf 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -158,6 +158,23 @@ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnote ^ response contents ] +{ #category : #accessing } +Markdeep >> file: aFileReference [ + file := aFileReference. + self fillInContentsFrom: aFileReference +] + +{ #category : #accessing } +Markdeep >> fillInContentsFrom: aFileReference [ + | docTree headTree | + docTree := (Markdown new contents: aFileReference contents) documentTree. + headTree := (docTree children + detect: [ :node | + node className = 'PPCMParagraph' + and: [ (node children detect: [ :subnode | subnode text = '' ]) isNotNil ] ]). + ^ headTree +] + { #category : #accessing } Markdeep >> folder [ ^ self file parent @@ -199,8 +216,11 @@ Markdeep >> gtTextFor: aView [ { #category : #accessing } Markdeep >> head [ - ^ head ifNil: [ head := OrderedCollection new. - head add: self fontAwesomeHeader; yourself ] + + ^ head ifNil: [ + head := OrderedCollection new. + head add: self fontAwesomeHeader; yourself. + ]. ] { #category : #accessing } diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 4134278..a144e53 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -103,6 +103,7 @@ Markdown >> detectYAMLMetadata [ { #category : #accessing } Markdown >> documentTree [ | parser| + self contents ifNil: [^ nil]. parser := PPCommonMarkBlockParser new parse: self contents. ^ parser accept: CMBlockVisitor new ] From 4199ed0a6cf7121317ab111b5ccd09cab9f21e82 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 4 Mar 2024 11:15:44 -0500 Subject: [PATCH 02/14] Improving Markdeep files reading and Markdown document tree views. --- src/MiniDocs/Markdeep.class.st | 15 ++++++++++++--- src/PetitMarkdown/PPCMBlockQuote.class.st | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 1f5feaf..50f963c 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -166,13 +166,22 @@ Markdeep >> file: aFileReference [ { #category : #accessing } Markdeep >> fillInContentsFrom: aFileReference [ - | docTree headTree | + | docTree docTreeChildren headTree tempTitle bodyLineIndex | docTree := (Markdown new contents: aFileReference contents) documentTree. - headTree := (docTree children + docTreeChildren := docTree children. + headTree := (docTreeChildren detect: [ :node | node className = 'PPCMParagraph' and: [ (node children detect: [ :subnode | subnode text = '' ]) isNotNil ] ]). - ^ headTree + headTree children allButFirst allButLast do: [:node | + (node className = 'PPCMHtml') ifTrue: [ self head add: node text ] + ]. + self head: self head asSet asOrderedCollection. + tempTitle := ((docTreeChildren detect: [ :node | node className = 'PPCMIndentedCode']) + children detect: [:subnode | subnode text trimmed beginsWith: '**']) text trimmed. + bodyLineIndex := docTreeChildren detectIndex: [ :node | node text includesSubstring: tempTitle ]. + self title: (tempTitle copyFrom: 3 to: tempTitle size - 2). + ^ { self head . self title . bodyLineIndex . docTree } ] { #category : #accessing } diff --git a/src/PetitMarkdown/PPCMBlockQuote.class.st b/src/PetitMarkdown/PPCMBlockQuote.class.st index eb218de..161abb1 100644 --- a/src/PetitMarkdown/PPCMBlockQuote.class.st +++ b/src/PetitMarkdown/PPCMBlockQuote.class.st @@ -23,3 +23,8 @@ PPCMBlockQuote >> initialize [ PPCMBlockQuote >> isBlockLevel [ ^ true ] + +{ #category : #accessing } +PPCMBlockQuote >> viewBody [ + ^ (self className ,' ', self text) asRopedText. +] From c162b9b4bccb0726cd16a0fded269a1a2e34a024 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 9 Mar 2024 12:05:25 -0500 Subject: [PATCH 03/14] Improving populating metadata from a given Markdeep file. --- src/MiniDocs/Markdeep.class.st | 64 ++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 50f963c..9f9f6e2 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -57,6 +57,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 +163,29 @@ 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: '