diff --git a/repository/Brea/BreaWikiPage.class.st b/repository/Brea/BreaWikiPage.class.st index 2e6471e..d06c486 100644 --- a/repository/Brea/BreaWikiPage.class.st +++ b/repository/Brea/BreaWikiPage.class.st @@ -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 +]