Using GtSubProcess to work on memory and avoid external files creation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-08-02 13:29:56 -05:00
parent b500a65c00
commit af81f92399

View File

@ -24,14 +24,17 @@ Class {
{ #category : #operation }
BreaPage >> bodyContentsAsHTML [
| sourcePage |
| sourcePage commandParameters |
self contentsFile ifNil: [ ^ self ].
sourcePage := self file file.
Smalltalk os isWindows ifTrue: [
^ Pandoc markdownToHtml: self file file
^ Pandoc markdownToHtml: sourcePage
].
sourcePage := FileLocator temp / 'wikiPage.md'.
MarkupFile exportAsFileOn: sourcePage containing: self contents.
^ Pandoc markdownToHtml: sourcePage
commandParameters := ' -f markdown+startnum+task_lists -t html '.
^ GtSubprocessWithInMemoryOutput new
shellCommand: 'pandoc', commandParameters, sourcePage fullName;
runAndWait;
stdout.
]
{ #category : #accessing }
@ -63,7 +66,7 @@ BreaPage >> contents [
result nextPutAll: (Markdown fromFile: markdownTempFile) contents.
]
].
^ result contents.
^ result contents withInternetLineEndings.
]
{ #category : #operation }