Implementing initial support for Pandoc in Windows. Includes html export, pdf export and html to markdown import. Last two functions keep on having issues.

This commit is contained in:
Ricardo Zapata 2017-12-01 20:15:04 +00:00 committed by Offray Luna
parent bebed308e2
commit 2ee75d58ac
2 changed files with 14 additions and 5 deletions

View File

@ -519,9 +519,14 @@ GrafoscopioNode >> htmlToMarkdown [
markdownFile := FileLocator temp asFileReference / 'body.markdown'.
markdownFile ensureDelete.
htmlFile writeStreamDo: [:out | out nextPutAll: self body ].
OSProcess
Smalltalk platformName = 'unix'
ifTrue: [ OSProcess
waitForCommand: 'pandoc -f html -t markdown --atx-headers ',
htmlFile fullName, ' -o ', markdownFile fullName.
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.

View File

@ -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)
]