From 5bb4c29bacccbe2350ee3feef620d7feb14d6d1f Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 7 Nov 2020 14:00:01 -0500 Subject: [PATCH] Starting multiplatform support for Pandoc. --- repository/Grafoscopio-Utils/Pandoc.class.st | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/repository/Grafoscopio-Utils/Pandoc.class.st b/repository/Grafoscopio-Utils/Pandoc.class.st index 5c91fc5..b97d436 100644 --- a/repository/Grafoscopio-Utils/Pandoc.class.st +++ b/repository/Grafoscopio-Utils/Pandoc.class.st @@ -114,6 +114,13 @@ Pandoc class >> luaFilters [ { #category : #converters } Pandoc class >> markdownToHtml: inputFile [ + (Smalltalk os isUnix or: [ Smalltalk os isMacOS ]) ifTrue: [ self markdownToHtmlOnUnix: inputFile ]. + Smalltalk os isWindows ifTrue: [ self markdownToHtmlOnWindows: inputFile ]. +] + +{ #category : #converters } +Pandoc class >> markdownToHtmlOnUnix: inputFile [ + | outputFile | outputFile := FileLocator temp / (inputFile basenameWithoutExtension , '.html'). outputFile ensureDelete. @@ -130,3 +137,10 @@ Pandoc class >> markdownToHtml: inputFile [ ifFalse: [ ^ inputFile ] ] ] + +{ #category : #converters } +Pandoc class >> markdownToHtmlOnWindows: inputFile [ + + + ^ LibC resultOfCommand: 'pandoc -f markdown+startnum+task_lists -t html inputFile fullName'. +]