Improving metadata handling for Markdeep exportation. Further modularization and refactoring is pending.
This commit is contained in:
parent
f89851f993
commit
1c536c7e96
@ -2,14 +2,7 @@ Extension { #name : #LeModel }
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LeModel >> metadata [
|
||||
^ OrderedDictionary new
|
||||
at: 'id' put: self uidString;
|
||||
at: 'parent' put: self parent uidString;
|
||||
at: 'created' put: self createTime asString;
|
||||
at: 'edited' put: self latestEditTime asString;
|
||||
at: 'creator' put: self createEmail asString;
|
||||
at: 'editor' put: self editEmail asString;
|
||||
yourself.
|
||||
^ self optionAt: 'metadata' ifAbsent: [ self optionAt: 'metadata' put: self metadataInit ]
|
||||
|
||||
]
|
||||
|
||||
@ -22,3 +15,15 @@ LeModel >> metadataDiv [
|
||||
nextPutAll: ' st-data="', (STON toString: self metadata), '">'; lf.
|
||||
^ output contents.
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LeModel >> metadataInit [
|
||||
^ OrderedDictionary new
|
||||
at: 'id' put: self uidString;
|
||||
at: 'title' put: self contentAsString;
|
||||
at: 'created' put: self createTime asString;
|
||||
at: 'modified' put: self latestEditTime asString;
|
||||
at: 'creator' put: self createEmail asString;
|
||||
at: 'modifier' put: self editEmail asString;
|
||||
yourself
|
||||
]
|
||||
|
@ -33,6 +33,13 @@ LePage >> asMarkdeepInto: aFileLocator [
|
||||
self preorderTraversal
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LePage >> detectSnippetWithUid: uidString [
|
||||
"Answer a boolean indicating whether the supplied uid is present"
|
||||
|
||||
^ self preorderTraversal detect: [ :snippet | snippet uidString = uidString ] ifNone: [ ^ nil ]
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LePage >> fileName [
|
||||
^ self title asDashedLowercase, '.', ((self uidString copyFrom: 1 to: 5 ) copyWithoutAll: '/'), '.md.html'
|
||||
@ -94,9 +101,11 @@ LePage >> options [
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LePage >> populateChildrenFrom: docTreeDivs [
|
||||
docTreeDivs doWithIndex: [:div :i |
|
||||
docTreeDivs doWithIndex: [:div :i | | snippet |
|
||||
snippet := LeSnippet fromMetaMarkdeep:div.
|
||||
self children
|
||||
addSnippet: (LeSnippet fromMetaMarkdeep:div) beforeIndex: i
|
||||
addSnippet: snippet beforeIndex: i.
|
||||
"self detectSnippetWithUid: "
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -35,3 +35,21 @@ LePictureSnippet >> contentFrom: markdeepDiv [
|
||||
optionAt: 'width' put: width.
|
||||
^ self urlString: (markdeepDiv // 'img' @ 'src') stringValue.
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LePictureSnippet >> metadataInit [
|
||||
^ OrderedDictionary new
|
||||
at: 'id' put: self uidString;
|
||||
at: 'parent' put: self parent uidString;
|
||||
at: 'url' put: self contentAsString;
|
||||
at: 'created' put: self createTime asString;
|
||||
at: 'modified' put: self latestEditTime asString;
|
||||
at: 'creator' put: self createEmail asString;
|
||||
at: 'modifier' put: self editEmail asString;
|
||||
yourself
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LePictureSnippet >> metatada [
|
||||
self optionAt: 'metadata' ifAbsent: [ self metadataInit ]
|
||||
]
|
||||
|
@ -8,3 +8,20 @@ LeTextSnippet >> contentFrom: markdeepDiv [
|
||||
sanitized := sanitized allButLast.
|
||||
self string: sanitized.
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LeTextSnippet >> metadata [
|
||||
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
|
||||
]
|
||||
|
||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||
LeTextSnippet >> metadataInit [
|
||||
^ OrderedDictionary new
|
||||
at: 'id' put: self uidString;
|
||||
at: 'title' put: self contentAsString;
|
||||
at: 'created' put: self createTime asString;
|
||||
at: 'modified' put: self latestEditTime asString;
|
||||
at: 'creator' put: self createEmail asString;
|
||||
at: 'modifier' put: self editEmail asString;
|
||||
yourself
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user