From 6035c6b3befcaa21f36286bb5641b35789ca2779 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 2 Nov 2014 21:21:46 +0000 Subject: [PATCH] =?UTF-8?q?Soporte=20de=20expotaci=C3=B3n=20desde=20men?= =?UTF-8?q?=C3=BA=20a=20Html=20v=C3=ADa=20pandoc.=20V=C3=A9ase=20commit=20?= =?UTF-8?q?http://mutabit.com/deltas/repos.fossil/grafoscopio/info/161092f?= =?UTF-8?q?9ca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Grafoscopio/GrafoscopioBrowser.class.st | 19 ++++++++++++++++--- .../Grafoscopio/GrafoscopioNode.class.st | 3 +-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 504e1e4..7d8d642 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -196,6 +196,19 @@ GrafoscopioBrowser >> customKeys [ key: ((bibliography entries at: index) fields at: 2) value ]]]. ] +{ #category : #persistence } +GrafoscopioBrowser >> exportAsHtml [ + "Exports the current tree to HTML, using the same name but different extension (.html)" + | markdownFileLocation htmlFileLocation pandoc | + markdownFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.markdown'. + htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'. + Smalltalk platform name = 'unix' + ifTrue: [ pandoc := (FileSystem disk workingDirectory / 'Platform' / 'Linux' / 'Programs' / 'Pandoc' / 'pandoc') fullName ]. + OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation. + self customKeys. + self inform: 'Archivo exportado como html'. +] + { #category : #persistence } GrafoscopioBrowser >> exportAsMarkdown: aTree on: locator [ @@ -228,6 +241,7 @@ GrafoscopioBrowser >> installPandoc [ linuxSupplies := (FileSystem disk workingDirectory / 'Platform' / 'Linux' / 'Programs' / 'Pandoc') ensureCreateDirectory. + ] { #category : #persistence } @@ -333,9 +347,7 @@ GrafoscopioBrowser >> saveToFile [ GrafoscopioBrowser >> saveWorkingTree [ "Saves the current tree to the user predefined file location used when he/she opened it." - | fileStream markdownFile | - - + | fileStream markdownFile | fileStream := workingFile writeStream. markdownFile := (workingFile parent) / (workingFile basenameWithoutExtension, '.markdown'). [ self exportAsSton: mainTree on: fileStream. @@ -413,6 +425,7 @@ GrafoscopioBrowser >> treeOn: constructor [ "Menu options" act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...'; act: [self saveToFile] entitled: 'Guardar como ...'; + act: [self exportAsHtml] entitled: 'Exportar como html'; act: [self updateSystem] entitled: 'Actualizar Grafoscopio'; act: [:x | x printString inspect] entitled: 'Acerca de...'. diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index fd1206b..bb95670 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -82,8 +82,7 @@ GrafoscopioNode >> addNodeAfter [ { #category : #exporting } GrafoscopioNode >> asMarkdown [ - "Exports children of the curren node as pandoc markdown, using special nodes for config options and - bibliography." + "Exports children of the curren node as pandoc markdown, using special nodes for config options and bibliography." | markdownOutput | markdownOutput := '' writeStream.