Wiki pages preliminar exportation working.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2020-07-26 21:09:53 -05:00
parent 5ad652f25b
commit e5303fa3e7

View File

@ -22,6 +22,24 @@ BreaWikiPage >> bodyContentsAsHTML [
^ Pandoc markdownToHtml: sourcePage
]
{ #category : #'as yet unclassified' }
BreaWikiPage >> exportAsHTML [
| htmlContents templateFile |
self shortName ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
templateFile := self namespace / self template.
htmlContents := (MustacheTemplate on: templateFile contents) value: self templateData.
"htmlContents."
^ 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 }
BreaWikiPage >> markdownFile [
| localFile |
@ -42,25 +60,19 @@ BreaWikiPage >> 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' }
BreaWikiPage >> populateBodyAs: key [
| allActions result |
| allActions result semaphore |
allActions := TKTFuture all: {
[self bodyContentsAsHTML] future.
[ self templateData at: key put: FileLocator temp / 'wikiPage.html' contents ] future
[ self bodyContentsAsHTML ] future.
}.
semaphore := Semaphore new.
allActions onSuccessDo: [ :values |
result := values ].
^ result.
result := values last.
semaphore signal ].
semaphore wait.
self templateData at: key put: result contents.
^ self.
]
{ #category : #operation }
@ -101,3 +113,10 @@ BreaWikiPage >> templateData [
BreaWikiPage >> templateData: aDictionary [
templateData := aDictionary
]
{ #category : #'as yet unclassified' }
BreaWikiPage >> templateFile [
self namespace ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
^ self namespace / self template
]