External page metadata and subpages support.
This commit is contained in:
parent
60c94d23e5
commit
bdd1813efb
@ -14,17 +14,19 @@ Class {
|
||||
'templateData',
|
||||
'namespace',
|
||||
'bodyTag',
|
||||
'splitters'
|
||||
'splitters',
|
||||
'subpages',
|
||||
'metadata'
|
||||
],
|
||||
#category : #Brea
|
||||
}
|
||||
|
||||
{ #category : #operation }
|
||||
BreaWikiPage >> bodyContentsAsHTML [
|
||||
| sourcePage |
|
||||
| sourcePage |
|
||||
self markdownFile ifNil: [ ^ self ].
|
||||
sourcePage := FileLocator temp / 'wikiPage.md'.
|
||||
MarkupFile exportAsFileOn: sourcePage containing: self markdownFile contents.
|
||||
MarkupFile exportAsFileOn: sourcePage containing: self contents.
|
||||
^ Pandoc markdownToHtml: sourcePage
|
||||
]
|
||||
|
||||
@ -45,6 +47,21 @@ BreaWikiPage >> bodyTag: aString [
|
||||
bodyTag := aString
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> contents [
|
||||
| result |
|
||||
self markdownFile ifNil: [ ^ self ].
|
||||
result := '' writeStream.
|
||||
result nextPutAll: self markdownFile contents.
|
||||
self subpages ifNotNil: [
|
||||
self subpages do: [ :sp | | markdownTempFile |
|
||||
markdownTempFile := self namespace / (sp, '.md').
|
||||
result nextPutAll: (Markdown fromFile: markdownTempFile) contents.
|
||||
]
|
||||
].
|
||||
^ result contents.
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
BreaWikiPage >> exportAsHTML [
|
||||
| htmlContents allActions semaphore result |
|
||||
@ -83,6 +100,18 @@ BreaWikiPage >> markdownFile [
|
||||
^ Markdown fromFile: localFile
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> metadata [
|
||||
^ metadata
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> metadata: aDictionary [
|
||||
"External place where page metadata is located (on Internet or the local file system) in JSON format.
|
||||
If nil, is suposed that is placed in the Markdown file with the page contents."
|
||||
metadata := aDictionary
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> namespace [
|
||||
^ namespace
|
||||
@ -108,11 +137,20 @@ BreaWikiPage >> populateBodyAs: key [
|
||||
^ self.
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
BreaWikiPage >> populateExternalMetadata [
|
||||
self metadata ifNil: [ ^ self ].
|
||||
self
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
BreaWikiPage >> populateMetadata [
|
||||
self markdownFile metadata keysAndValuesDo: [ :key :value |
|
||||
self templateData at: key put: value
|
||||
].
|
||||
| metadataTemp |
|
||||
self metadata
|
||||
ifNotNil: [ metadataTemp := self metadata ]
|
||||
ifNil: [ metadataTemp := self markdownFile metadata].
|
||||
metadataTemp keysAndValuesDo: [ :key :value |
|
||||
self templateData at: key put: value ].
|
||||
^ templateData
|
||||
]
|
||||
|
||||
@ -123,6 +161,8 @@ BreaWikiPage >> shortName [
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> shortName: aString [
|
||||
"The name of the file tha contains the light markup to produce the web page, without file extension.
|
||||
By default I work with Markdown files."
|
||||
shortName := aString
|
||||
]
|
||||
|
||||
@ -161,6 +201,18 @@ BreaWikiPage >> splitters: aDictionary [
|
||||
splitters := aDictionary
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> subpages [
|
||||
^ subpages
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> subpages: shortNamesList [
|
||||
"I am used when a page is composed of other subpages (for example with link aliases) that are shared
|
||||
accross several pages."
|
||||
subpages := shortNamesList
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWikiPage >> template [
|
||||
^ template
|
||||
|
13
repository/Brea/ManifestBrea.class.st
Normal file
13
repository/Brea/ManifestBrea.class.st
Normal file
@ -0,0 +1,13 @@
|
||||
"
|
||||
I store metadata for this package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
|
||||
"
|
||||
Class {
|
||||
#name : #ManifestBrea,
|
||||
#superclass : #PackageManifest,
|
||||
#category : #'Brea-Manifest'
|
||||
}
|
||||
|
||||
{ #category : #'code-critics' }
|
||||
ManifestBrea class >> ruleRBStringConcatenationRuleV1FalsePositive [
|
||||
^ #(#(#(#RGMethodDefinition #(#BreaWikiPage #contents #false)) #'2020-08-28T20:08:20.291489-05:00') )
|
||||
]
|
Loading…
Reference in New Issue
Block a user