External page metadata and subpages support.
This commit is contained in:
parent
60c94d23e5
commit
bdd1813efb
@ -14,17 +14,19 @@ Class {
|
|||||||
'templateData',
|
'templateData',
|
||||||
'namespace',
|
'namespace',
|
||||||
'bodyTag',
|
'bodyTag',
|
||||||
'splitters'
|
'splitters',
|
||||||
|
'subpages',
|
||||||
|
'metadata'
|
||||||
],
|
],
|
||||||
#category : #Brea
|
#category : #Brea
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #operation }
|
{ #category : #operation }
|
||||||
BreaWikiPage >> bodyContentsAsHTML [
|
BreaWikiPage >> bodyContentsAsHTML [
|
||||||
| sourcePage |
|
| sourcePage |
|
||||||
self markdownFile ifNil: [ ^ self ].
|
self markdownFile ifNil: [ ^ self ].
|
||||||
sourcePage := FileLocator temp / 'wikiPage.md'.
|
sourcePage := FileLocator temp / 'wikiPage.md'.
|
||||||
MarkupFile exportAsFileOn: sourcePage containing: self markdownFile contents.
|
MarkupFile exportAsFileOn: sourcePage containing: self contents.
|
||||||
^ Pandoc markdownToHtml: sourcePage
|
^ Pandoc markdownToHtml: sourcePage
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -45,6 +47,21 @@ BreaWikiPage >> bodyTag: aString [
|
|||||||
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' }
|
{ #category : #'as yet unclassified' }
|
||||||
BreaWikiPage >> exportAsHTML [
|
BreaWikiPage >> exportAsHTML [
|
||||||
| htmlContents allActions semaphore result |
|
| htmlContents allActions semaphore result |
|
||||||
@ -83,6 +100,18 @@ BreaWikiPage >> markdownFile [
|
|||||||
^ Markdown fromFile: localFile
|
^ 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 }
|
{ #category : #accessing }
|
||||||
BreaWikiPage >> namespace [
|
BreaWikiPage >> namespace [
|
||||||
^ namespace
|
^ namespace
|
||||||
@ -108,11 +137,20 @@ BreaWikiPage >> populateBodyAs: key [
|
|||||||
^ self.
|
^ self.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
BreaWikiPage >> populateExternalMetadata [
|
||||||
|
self metadata ifNil: [ ^ self ].
|
||||||
|
self
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #operation }
|
{ #category : #operation }
|
||||||
BreaWikiPage >> populateMetadata [
|
BreaWikiPage >> populateMetadata [
|
||||||
self markdownFile metadata keysAndValuesDo: [ :key :value |
|
| metadataTemp |
|
||||||
self templateData at: key put: value
|
self metadata
|
||||||
].
|
ifNotNil: [ metadataTemp := self metadata ]
|
||||||
|
ifNil: [ metadataTemp := self markdownFile metadata].
|
||||||
|
metadataTemp keysAndValuesDo: [ :key :value |
|
||||||
|
self templateData at: key put: value ].
|
||||||
^ templateData
|
^ templateData
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -123,6 +161,8 @@ BreaWikiPage >> shortName [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
BreaWikiPage >> shortName: aString [
|
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
|
shortName := aString
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -161,6 +201,18 @@ BreaWikiPage >> splitters: aDictionary [
|
|||||||
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 }
|
{ #category : #accessing }
|
||||||
BreaWikiPage >> template [
|
BreaWikiPage >> template [
|
||||||
^ 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