Merge 7a704d517d
This commit is contained in:
commit
3277bd49b6
@ -2,8 +2,16 @@ Extension { #name : #LePage }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> asHtmlFile [
|
||||
|
||||
self asMarkdownFile.
|
||||
"pandoc" self htmlFileName
|
||||
self defaultPandocTemplate exists
|
||||
ifFalse: [ MarkupFile installTemplate: 'https://mutabit.com/repos.fossil/mutabit/doc/trunk/plantillas/Pandoc/clean-menu-mod.html' into: self defaultPandocTemplate parent ].
|
||||
|
||||
OSSUnixSubprocess new
|
||||
command: 'pandoc' ;
|
||||
arguments: { self markdownFileName. '-o'. self htmlFileName};
|
||||
workingDirectory: self storage;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ self storage / self htmlFileName].
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
@ -67,6 +75,12 @@ LePage >> asMarkdownFile [
|
||||
^ MarkupFile exportAsFileOn: folder / self markdownFileName containing: self asMarkdown contents
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> defaultPandocTemplate [
|
||||
|
||||
^ FileLocator home / '.pandoc' / 'templates' / 'clean-menu-mod.html'
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> exportedFileName [
|
||||
| sanitized |
|
||||
@ -97,3 +111,10 @@ LePage >> preorderTraversal [
|
||||
self withDeepCollect: [:each | each allChildrenBreadthFirstDo: [:child | output add: child ] ].
|
||||
^ output.
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> storage [
|
||||
|
||||
^ self optionAt: 'storage'
|
||||
ifAbsent: [ ^ FileLocator temp ]
|
||||
]
|
||||
|
@ -21,3 +21,17 @@ MarkupFile class >> exportAsFileOn: aFileReferenceOrFileName containing: text [
|
||||
self inform: 'Exported as: ', String cr, file fullName.
|
||||
^ file
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
MarkupFile class >> installTemplate: anUrl into: aFolder [
|
||||
|
||||
| fileName |
|
||||
fileName := anUrl asUrl segments last.
|
||||
(aFolder / fileName) exists
|
||||
ifTrue: [ (aFolder / fileName) ensureDeleteFile ]
|
||||
ifFalse: [ aFolder ensureCreateDirectory ].
|
||||
ZnClient new
|
||||
url: anUrl;
|
||||
downloadTo: aFolder.
|
||||
^ aFolder
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user