Migrating from GrafoscopioUtils.
This commit is contained in:
parent
5f37293f4d
commit
3876b12eb9
@ -84,6 +84,13 @@ LePage >> defaultPandocTemplate [
|
|||||||
^ FileLocator home / '.pandoc' / 'templates' / 'clean-menu-mod.html'
|
^ FileLocator home / '.pandoc' / 'templates' / 'clean-menu-mod.html'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePage >> detectParentSnippetWithUid: uidString [
|
||||||
|
"Answer a boolean indicating whether the supplied uid is present"
|
||||||
|
|
||||||
|
^ self preorderTraversal detect: [ :snippet | snippet uidString = uidString ] ifNone: [ ^ self ]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePage >> exportedFileName [
|
LePage >> exportedFileName [
|
||||||
| sanitized |
|
| sanitized |
|
||||||
@ -91,6 +98,28 @@ LePage >> exportedFileName [
|
|||||||
^ sanitized , '--' , (self uidString copyFrom: 1 to: 5)
|
^ sanitized , '--' , (self uidString copyFrom: 1 to: 5)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePage >> fileName [
|
||||||
|
^ self title asDashedLowercase, '.', ((self uidString copyFrom: 1 to: 5 ) copyWithoutAll: '/'), '.md.html'
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePage >> fromMarkdeepUrl: aString [
|
||||||
|
| docTree pageMetadata |
|
||||||
|
docTree := GrafoscopioUtils xmlFromUrl: aString.
|
||||||
|
pageMetadata := Markdeep new metadataFromXML: docTree.
|
||||||
|
self
|
||||||
|
basicUid: (pageMetadata at: 'id');
|
||||||
|
title: (pageMetadata at: 'title');
|
||||||
|
createTime: (pageMetadata at: 'created') asDateAndTime;
|
||||||
|
editTime: (pageMetadata at: 'modified') asDateAndTime;
|
||||||
|
createEmail: (pageMetadata at: 'creator');
|
||||||
|
editEmail: (pageMetadata at: 'modifier');
|
||||||
|
optionAt: 'metadata' put: pageMetadata.
|
||||||
|
self populateChildrenFrom: (docTree xpath: '//div')
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePage >> htmlFileName [
|
LePage >> htmlFileName [
|
||||||
^ self exportedFileName, '.html'
|
^ self exportedFileName, '.html'
|
||||||
@ -126,6 +155,15 @@ LePage >> metadataInit [
|
|||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePage >> navTop [
|
||||||
|
| topNavFile |
|
||||||
|
topNavFile := ((self optionAt: 'storage') / '_navtop.html').
|
||||||
|
topNavFile exists
|
||||||
|
ifFalse: [ ^ '' ]
|
||||||
|
ifTrue: [ ^ topNavFile contents ]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePage >> options [
|
LePage >> options [
|
||||||
^ options
|
^ options
|
||||||
@ -139,6 +177,13 @@ LePage >> preorderTraversal [
|
|||||||
^ output.
|
^ output.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePage >> removeSnippetsMetadata [
|
||||||
|
self preorderTraversal do: [ :snippet |
|
||||||
|
(snippet options isNotNil and: [ snippet options includesKey: 'metadata' ])
|
||||||
|
ifTrue: [ snippet options removeKey: 'metadata' ] ]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePage >> storage [
|
LePage >> storage [
|
||||||
|
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Extension { #name : #LePharoSnippet }
|
Extension { #name : #LePharoSnippet }
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LePharoSnippet >> contentAsStringCustomized [
|
||||||
|
| customCoder |
|
||||||
|
(self tags includes: 'output') ifFalse: [ ^ self contentAsString ].
|
||||||
|
customCoder := GtPharoSnippetCoder forSource: self contentAsString.
|
||||||
|
^ (customCoder doItAll) value greaseString
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePharoSnippet >> markdeepCustomCloser [
|
LePharoSnippet >> markdeepCustomCloser [
|
||||||
^ String streamContents: [ :stream |
|
^ String streamContents: [ :stream |
|
||||||
@ -20,6 +28,7 @@ LePharoSnippet >> markdeepCustomOpener [
|
|||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePharoSnippet >> markdownCustomCloser [
|
LePharoSnippet >> markdownCustomCloser [
|
||||||
|
(self tags includes: 'output') ifTrue: [^ String with: Character lf].
|
||||||
^ String streamContents: [:stream |
|
^ String streamContents: [:stream |
|
||||||
stream
|
stream
|
||||||
nextPutAll: '~~~'; lf
|
nextPutAll: '~~~'; lf
|
||||||
@ -28,8 +37,10 @@ LePharoSnippet >> markdownCustomCloser [
|
|||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LePharoSnippet >> markdownCustomOpener [
|
LePharoSnippet >> markdownCustomOpener [
|
||||||
^ String streamContents: [:stream |
|
(self tags includes: 'output') ifTrue: [ ^ String with: Character lf ].
|
||||||
stream
|
^ String
|
||||||
nextPutAll: '~~~ Smalltalk'; lf
|
streamContents: [ :stream |
|
||||||
]
|
stream
|
||||||
|
nextPutAll: '~~~ Smalltalk';
|
||||||
|
lf ]
|
||||||
]
|
]
|
||||||
|
@ -10,12 +10,17 @@ LeTextualSnippet >> asMarkdown [
|
|||||||
nextPutAll: '<div st-class="', self class asString, '"'; lf;
|
nextPutAll: '<div st-class="', self class asString, '"'; lf;
|
||||||
nextPutAll: ' st-data="', (STON toString: self metadata), '">'; lf;
|
nextPutAll: ' st-data="', (STON toString: self metadata), '">'; lf;
|
||||||
nextPutAll: self markdownCustomOpener;
|
nextPutAll: self markdownCustomOpener;
|
||||||
nextPutAll: self contentAsString; lf;
|
nextPutAll: self contentAsStringCustomized; lf;
|
||||||
nextPutAll: self markdownCustomCloser;
|
nextPutAll: self markdownCustomCloser;
|
||||||
nextPutAll: '</div>'; lf; lf.
|
nextPutAll: '</div>'; lf; lf.
|
||||||
^ output contents
|
^ output contents
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LeTextualSnippet >> contentAsStringCustomized [
|
||||||
|
^ self contentAsString
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LeTextualSnippet >> markdeepCustomCloser [
|
LeTextualSnippet >> markdeepCustomCloser [
|
||||||
^ ''
|
^ ''
|
||||||
@ -35,3 +40,8 @@ LeTextualSnippet >> markdownCustomCloser [
|
|||||||
LeTextualSnippet >> markdownCustomOpener [
|
LeTextualSnippet >> markdownCustomOpener [
|
||||||
^ self markdeepCustomOpener
|
^ self markdeepCustomOpener
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LeTextualSnippet >> tags [
|
||||||
|
^ self metadata at: 'tags'
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user