Making bodyTag optinal in HTML templates, in preparation for JSON support.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2020-11-07 11:47:41 -05:00
parent cd938cf480
commit 45f1ac84b1

View File

@ -73,15 +73,12 @@ BreaPage >> contentsFile [
{ #category : #'as yet unclassified' }
BreaPage >> exportAsHTML [
| htmlContents allActions semaphore result |
| htmlContents allActions actionsArray semaphore result |
self shortName ifNil: [ ^ self ].
self template ifNil: [ ^ self ].
self bodyTag ifNil: [ ^ self ].
allActions := TKTFuture all: {
[ self populateMetadata ] future.
[ self split ] future.
[ self populateBodyAs: self bodyTag ] future.
}.
actionsArray := { [ self populateMetadata ] future. [ self split ] future. }.
self bodyTag ifNotNil: [ actionsArray := actionsArray copyWith: [ self populateBodyAs: self bodyTag ] future ].
allActions := TKTFuture all: actionsArray.
semaphore := Semaphore new.
allActions onSuccessDo: [ :values |
result := values last.
@ -94,7 +91,8 @@ BreaPage >> exportAsHTML [
{ #category : #accessing }
BreaPage >> file [
^ file
(self shortName isNil or: [ self folder isNil ]) ifTrue: [ ^ nil ].
^ file ifNil: [ ^ BreaFile fromShortName: self shortName andFolder: self folder ]
]
{ #category : #accessing }
@ -134,6 +132,7 @@ BreaPage >> metadata: aDictionary [
{ #category : #'as yet unclassified' }
BreaPage >> populateBodyAs: key [
| allActions result semaphore |
"(self file isMarkdown and: [ self bodyTag isNil ]) ifTrue: [ ^ self ]".
allActions := TKTFuture all: {
[ self bodyContentsAsHTML ] future.
}.