Resync after some image de-synchronization. #1

Manually merged
Offray merged 1 commits from resync into master 2020-07-28 02:11:00 +00:00
Showing only changes of commit 1a6c46840a - Show all commits

View File

@ -8,7 +8,8 @@ Class {
'shortName', 'shortName',
'template', 'template',
'templateData', 'templateData',
'namespace' 'namespace',
'bodyTag'
], ],
#category : #Brea #category : #Brea
} }
@ -22,6 +23,50 @@ BreaWikiPage >> bodyContentsAsHTML [
^ Pandoc markdownToHtml: sourcePage ^ Pandoc markdownToHtml: sourcePage
] ]
{ #category : #accessing }
BreaWikiPage >> bodyTag [
^ bodyTag
]
{ #category : #accessing }
BreaWikiPage >> bodyTag: aString [
"I represent the Mustache Template tag used to denote the body part of a page.
While the metadata is self describing via YAML metadata blocks in Markddown, so
they map where ever they are needed in a template, the Markdown file that will be converted
in HTML via a template doesn't know which part should occupy once the conversion is done.
I provide such knowledge. So if a page template puts the body content under the mustache tag
{{content}}, I should use bodyTag: 'content'.
bodyTag: is template dependant."
bodyTag := aString
]
{ #category : #'as yet unclassified' }
BreaWikiPage >> exportAsHTML [
| htmlContents allActions semaphore result |
self shortName ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
self bodyTag ifNil: [ ^ self ].
allActions := TKTFuture all: {
[ self populateMetadata ] future.
[ self populateBodyAs: self bodyTag ] future.
}.
semaphore := Semaphore new.
allActions onSuccessDo: [ :values |
result := values last.
semaphore signal.
].
semaphore wait.
htmlContents := (MustacheTemplate on: result templateFile contents) value: result templateData.
^ MarkupFile exportAsFileOn: self namespace / (self shortName, '.html' ) containing: htmlContents
]
{ #category : #'as yet unclassified' }
BreaWikiPage >> htmlContents [
self shortName ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
^ (MustacheTemplate on: self templateFile contents) value: self templateData.
]
{ #category : #operation } { #category : #operation }
BreaWikiPage >> markdownFile [ BreaWikiPage >> markdownFile [
| localFile | | localFile |
@ -42,25 +87,19 @@ BreaWikiPage >> namespace: folderFileReference [
namespace := folderFileReference namespace := folderFileReference
] ]
{ #category : #'as yet unclassified' }
BreaWikiPage >> populateBodyAs2: key [
[self bodyContentsAsHTML] future
andThen: [:result | self templateData at: key put: result contents]
]
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
BreaWikiPage >> populateBodyAs: key [ BreaWikiPage >> populateBodyAs: key [
| allActions result | | allActions result semaphore |
allActions := TKTFuture all: { allActions := TKTFuture all: {
[ self bodyContentsAsHTML ] future. [ self bodyContentsAsHTML ] future.
[ self templateData at: key put: FileLocator temp / 'wikiPage.html' contents ] future
}. }.
semaphore := Semaphore new.
allActions onSuccessDo: [ :values | allActions onSuccessDo: [ :values |
result := values ]. result := values last.
^ result. semaphore signal ].
semaphore wait.
self templateData at: key put: result contents.
^ self.
] ]
{ #category : #operation } { #category : #operation }
@ -101,3 +140,10 @@ BreaWikiPage >> templateData [
BreaWikiPage >> templateData: aDictionary [ BreaWikiPage >> templateData: aDictionary [
templateData := aDictionary templateData := aDictionary
] ]
{ #category : #'as yet unclassified' }
BreaWikiPage >> templateFile [
self namespace ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
^ self namespace / self template
]