From af81f92399328f486c813d76cc461bcc1e25de5f Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 2 Aug 2024 13:29:56 -0500 Subject: [PATCH] Using GtSubProcess to work on memory and avoid external files creation. --- repository/Brea/BreaPage.class.st | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/repository/Brea/BreaPage.class.st b/repository/Brea/BreaPage.class.st index afb2bd3..c0649b1 100644 --- a/repository/Brea/BreaPage.class.st +++ b/repository/Brea/BreaPage.class.st @@ -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 }