From 2ee75d58ac5e0ac983bd977357cafab041a72191 Mon Sep 17 00:00:00 2001 From: Ricardo Zapata Date: Fri, 1 Dec 2017 20:15:04 +0000 Subject: [PATCH] Implementing initial support for Pandoc in Windows. Includes html export, pdf export and html to markdown import. Last two functions keep on having issues. --- repository/Grafoscopio/GrafoscopioNode.class.st | 11 ++++++++--- repository/Grafoscopio/GrafoscopioNotebook.class.st | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index b9f0790..a712d11 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -519,9 +519,14 @@ GrafoscopioNode >> htmlToMarkdown [ markdownFile := FileLocator temp asFileReference / 'body.markdown'. markdownFile ensureDelete. htmlFile writeStreamDo: [:out | out nextPutAll: self body ]. - OSProcess - waitForCommand: 'pandoc -f html -t markdown --atx-headers ', - htmlFile fullName, ' -o ', markdownFile fullName. + Smalltalk platformName = 'unix' + ifTrue: [ OSProcess + waitForCommand: 'pandoc -f html -t markdown --atx-headers ', + htmlFile fullName, ' -o ', markdownFile fullName ]. + Smalltalk platformName = 'Win32' + ifTrue: [ WindowsProcess + waitForCommand: 'pandoc -f html -t markdown --atx-headers ', + htmlFile fullName, ' -o ', markdownFile fullName ]. self body: markdownFile contents. htmlFile ensureDelete. markdownFile ensureDelete. diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index a7acdb1..74bbe26 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -187,7 +187,10 @@ GrafoscopioNotebook >> exportAsHTML [ self exportAsMarkdown. htmlFile := self markdownFile parent fullName,'/', self markdownFile basenameWithoutExtension, '.html'. htmlFile asFileReference exists ifTrue: [ htmlFile asFileReference delete ]. - OSProcess command: 'pandoc --standalone ', self markdownFile fullName, ' -o ', htmlFile. + Smalltalk platformName = 'unix' + ifTrue: [OSProcess command: 'pandoc --standalone ', self markdownFile fullName, ' -o ', htmlFile]. + Smalltalk platformName = 'Win32' + ifTrue: [WindowsProcess command: 'pandoc --standalone ', self markdownFile fullName, ' -o ', htmlFile]. self inform: ('File exported as: ', String cr, htmlFile). ] @@ -225,7 +228,8 @@ GrafoscopioNotebook >> exportAsPDF [ pandocCommand := 'cd ', self markdownFile parent fullName,'; ', 'pandoc ', self pandocOptionsComputed, ' ', self markdownFile fullName, ' -o ', self pdfFile fullName. - ExternalOSProcess command: pandocCommand. + Smalltalk platformName = 'unix' ifTrue: [ ExternalOSProcess command: pandocCommand ]. + Smalltalk platformName = 'Win32' ifTrue: [ WindowsProcess command: pandocCommand ]. self inform: ('File exported as: ', String cr, self pdfFile fullName) ]