From 2bc0b44fa2d3eaf185dbc151855703a82edb251b Mon Sep 17 00:00:00 2001 From: ruidajo Date: Wed, 17 Jul 2024 14:37:15 -0500 Subject: [PATCH 1/5] Modifying baseline for testing with Lepiter Building Blocs dependency. --- src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st index 5ec783b..c6ee923 100644 --- a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st +++ b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st @@ -14,7 +14,7 @@ BaselineOfMiniDocs >> baseline: spec [ self setUpTeapot: spec. self setUpPetitParser: spec. "LepiterBuildingBlocs commented while resolving the conflict with the internal gtoolkit renaming." - "self setUpLepiterBuildingBlocs: spec" + self setUpLepiterBuildingBlocs: spec spec baseline: 'Mustache' with: [ spec repository: 'github://noha/mustache' ]; baseline: 'Temple' with: [ spec repository: 'github://astares/Pharo-Temple/src' ]; @@ -32,7 +32,8 @@ BaselineOfMiniDocs >> baseline: spec [ 'Mustache' 'Temple' "Templating" 'Teapot' 'Tealight' "Web server" 'PetitMarkdown' 'PetitParser' "Parsers" - 'DataFrame' "Tabular data")]. + 'DataFrame' "Tabular data" + 'LepiterBuildingBlocs' "Lepiter utilities")]. . "Groups" @@ -61,9 +62,10 @@ BaselineOfMiniDocs >> setUpLepiterBuildingBlocs: spec [ spec baseline: 'LepiterBuildingBlocs' with: [spec - repository: 'github://botwhytho/LepiterBuildingBlocs:main/src'; + repository: 'github://botwhytho/LepiterBuildingBlocs:main/src']"; loads: #('ALL')]; - import: 'LepiterBuildingBlocs' + import: 'LepiterBuildingBlocs'" + "COMMENTED for baseline testing" ] { #category : #accessing } From 8cadf004dd1f3b3ff779e784051000cd598d16ca Mon Sep 17 00:00:00 2001 From: ruidajo Date: Wed, 17 Jul 2024 14:40:17 -0500 Subject: [PATCH 2/5] Fixing typo in baseline. testing for Lepiter building blocs dependency. --- src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st index c6ee923..5bbf6e2 100644 --- a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st +++ b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st @@ -14,7 +14,7 @@ BaselineOfMiniDocs >> baseline: spec [ self setUpTeapot: spec. self setUpPetitParser: spec. "LepiterBuildingBlocs commented while resolving the conflict with the internal gtoolkit renaming." - self setUpLepiterBuildingBlocs: spec + self setUpLepiterBuildingBlocs: spec. spec baseline: 'Mustache' with: [ spec repository: 'github://noha/mustache' ]; baseline: 'Temple' with: [ spec repository: 'github://astares/Pharo-Temple/src' ]; From 6e58c5631dadf6008f052098d67a0e0131d84504 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Wed, 17 Jul 2024 14:45:22 -0500 Subject: [PATCH 3/5] Fixing Lepiter Building Blocs. --- src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st index 5bbf6e2..1a89dac 100644 --- a/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st +++ b/src/BaselineOfMiniDocs/BaselineOfMiniDocs.class.st @@ -13,8 +13,7 @@ BaselineOfMiniDocs >> baseline: spec [ "Dependencies" self setUpTeapot: spec. self setUpPetitParser: spec. - "LepiterBuildingBlocs commented while resolving the conflict with the internal gtoolkit renaming." - self setUpLepiterBuildingBlocs: spec. + self setUpLepiterBuildingBlocs: spec. "working in v1.0.993" spec baseline: 'Mustache' with: [ spec repository: 'github://noha/mustache' ]; baseline: 'Temple' with: [ spec repository: 'github://astares/Pharo-Temple/src' ]; @@ -62,10 +61,7 @@ BaselineOfMiniDocs >> setUpLepiterBuildingBlocs: spec [ spec baseline: 'LepiterBuildingBlocs' with: [spec - repository: 'github://botwhytho/LepiterBuildingBlocs:main/src']"; - loads: #('ALL')]; - import: 'LepiterBuildingBlocs'" - "COMMENTED for baseline testing" + repository: 'github://botwhytho/LepiterBuildingBlocs:main/src'] ] { #category : #accessing } From 6072fd8971a122b1be207e865acd79491556b7a9 Mon Sep 17 00:00:00 2001 From: Offray Date: Thu, 18 Jul 2024 16:26:32 -0500 Subject: [PATCH 4/5] Retaking taging as a way to improve document export/import. --- src/MiniDocs/LeTextSnippet.extension.st | 3 +-- src/MiniDocs/LeTextualSnippet.extension.st | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MiniDocs/LeTextSnippet.extension.st b/src/MiniDocs/LeTextSnippet.extension.st index 5a65a0e..367f9ee 100644 --- a/src/MiniDocs/LeTextSnippet.extension.st +++ b/src/MiniDocs/LeTextSnippet.extension.st @@ -61,6 +61,5 @@ LeTextSnippet >> parentId [ { #category : #'*MiniDocs' } LeTextSnippet >> taggedWith: aString [ - self metadata at: 'tags' ifPresent: [ (self metadata at: 'tags') add: aString; yourself ] ifAbsentPut: [ Set new ]. - ^ self metadata at: 'tags' + self tags add: aString. ] diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index 55850e5..f83aa95 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -81,6 +81,11 @@ LeTextualSnippet >> contentAsStringCustomized [ ifFalse: [ ^ self contentAsString ] ] +{ #category : #'*MiniDocs' } +LeTextualSnippet >> extra [ + ^ self optionAt: 'extra' ifAbsentPut: [ Dictionary new ] +] + { #category : #'*MiniDocs' } LeTextualSnippet >> markdeepCustomCloser [ ^ '' @@ -134,6 +139,7 @@ LeTextualSnippet >> metadataUpdate [ at: 'modified' put: self latestEditTime asString; at: 'creator' put: createEmailSanitized; at: 'modifier' put: editEmailSanitized; + at: 'extra' put: self extra; yourself ] @@ -151,5 +157,5 @@ LeTextualSnippet >> sanitizeMetadata [ { #category : #'*MiniDocs' } LeTextualSnippet >> tags [ - ^ self metadata at: 'tags' ifAbsentPut: [ Set new ] + ^ self extra at: 'tags' ifAbsentPut: [ Set new ] ] From 94fdf3052fdf61da3b3f8bd8b6d62610f753fcf5 Mon Sep 17 00:00:00 2001 From: Offray Date: Thu, 18 Jul 2024 17:08:46 -0500 Subject: [PATCH 5/5] Modularizing and cleaning to improve upcoming support for tagged snippets. --- src/MiniDocs/LeTextualSnippet.extension.st | 60 ++++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index f83aa95..734fe39 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -45,33 +45,8 @@ LeTextualSnippet >> asMarkdownWithMetadataWrappers [ { #category : #'*MiniDocs' } LeTextualSnippet >> contentAsStringAnnotated [ - | annotations substitutions exported pageConfig| - self ast ifNil: [ ^ self contentAsString ]. - annotations := self ast parts select: [:each | each className includesSubstring: 'AnnotationNode' ]. - annotations ifEmpty: [ ^ self contentAsString ]. - substitutions := OrderedDictionary new. - pageConfig := self page config. - annotations do: [ :each | | key type value color | - key := each source. - type := (key splitOn: ':') first copyWithoutAll: '{{'. - value := key copyFrom: type size + 4 to: key size - 2. - pageConfig - ifNil: [ color := 'default' ] - ifNotNil: [ | colors | - colors := pageConfig at: 'annotationColors' ifAbsent: [ nil ]. - colors ifNotNil: [ - color := colors at: type ifAbsent: [ colors at: 'defaultColor' ifAbsentPut: ['default'] ] - ] - ]. - substitutions - at: key - put: '', value,''. - ]. - exported := self contentAsString. - substitutions keysAndValuesDo: [:k :v | - exported := exported copyReplaceAll: k with: v. - ]. - ^ exported + self ast ifNotNil: [ ^ self processSnippetAnnotations ]. + ^ self contentAsString ] { #category : #'*MiniDocs' } @@ -143,6 +118,37 @@ LeTextualSnippet >> metadataUpdate [ yourself ] +{ #category : #'*MiniDocs' } +LeTextualSnippet >> processSnippetAnnotations [ + | exported substitutions annotations pageConfig | + annotations := self ast parts + select: [ :each | each className includesSubstring: 'AnnotationNode' ]. + annotations ifEmpty: [ ^ self contentAsString ]. + substitutions := OrderedDictionary new. + pageConfig := self page config. + annotations + do: [ :each | + | key type value color | + key := each source. + type := (key splitOn: ':') first copyWithoutAll: '{{'. + value := key copyFrom: type size + 4 to: key size - 2. + pageConfig + ifNil: [ color := 'default' ] + ifNotNil: [ | colors | + colors := pageConfig at: 'annotationColors' ifAbsent: [ nil ]. + colors + ifNotNil: [ color := colors + at: type + ifAbsent: [ colors at: 'defaultColor' ifAbsentPut: [ 'default' ] ] ] ]. + substitutions + at: key + put: '' , value , '' ]. + exported := self contentAsString. + substitutions + keysAndValuesDo: [ :k :v | exported := exported copyReplaceAll: k with: v ]. + ^ exported +] + { #category : #'*MiniDocs' } LeTextualSnippet >> sanitizeMetadata [ self options ifNil: [^ self ].