Soporte de expotación desde menú a Html vía pandoc. Véase commit http://mutabit.com/deltas/repos.fossil/grafoscopio/info/161092f9ca

This commit is contained in:
Offray Vladimir Luna Cárdenas 2014-11-02 21:21:46 +00:00
parent 9e9f65c958
commit 6035c6b3be
2 changed files with 17 additions and 5 deletions

View File

@ -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...'.

View File

@ -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.