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 ]]]. 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 } { #category : #persistence }
GrafoscopioBrowser >> exportAsMarkdown: aTree on: locator [ GrafoscopioBrowser >> exportAsMarkdown: aTree on: locator [
@ -228,6 +241,7 @@ GrafoscopioBrowser >> installPandoc [
linuxSupplies := (FileSystem disk workingDirectory linuxSupplies := (FileSystem disk workingDirectory
/ 'Platform' / 'Linux' / 'Programs' / 'Pandoc') / 'Platform' / 'Linux' / 'Programs' / 'Pandoc')
ensureCreateDirectory. ensureCreateDirectory.
] ]
{ #category : #persistence } { #category : #persistence }
@ -333,9 +347,7 @@ GrafoscopioBrowser >> saveToFile [
GrafoscopioBrowser >> saveWorkingTree [ GrafoscopioBrowser >> saveWorkingTree [
"Saves the current tree to the user predefined file location used when he/she opened it." "Saves the current tree to the user predefined file location used when he/she opened it."
| fileStream markdownFile | | fileStream markdownFile |
fileStream := workingFile writeStream. fileStream := workingFile writeStream.
markdownFile := (workingFile parent) / (workingFile basenameWithoutExtension, '.markdown'). markdownFile := (workingFile parent) / (workingFile basenameWithoutExtension, '.markdown').
[ self exportAsSton: mainTree on: fileStream. [ self exportAsSton: mainTree on: fileStream.
@ -413,6 +425,7 @@ GrafoscopioBrowser >> treeOn: constructor [
"Menu options" "Menu options"
act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...'; act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...';
act: [self saveToFile] entitled: 'Guardar como ...'; act: [self saveToFile] entitled: 'Guardar como ...';
act: [self exportAsHtml] entitled: 'Exportar como html';
act: [self updateSystem] entitled: 'Actualizar Grafoscopio'; act: [self updateSystem] entitled: 'Actualizar Grafoscopio';
act: [:x | x printString inspect] entitled: 'Acerca de...'. act: [:x | x printString inspect] entitled: 'Acerca de...'.

View File

@ -82,8 +82,7 @@ GrafoscopioNode >> addNodeAfter [
{ #category : #exporting } { #category : #exporting }
GrafoscopioNode >> asMarkdown [ GrafoscopioNode >> asMarkdown [
"Exports children of the curren node as pandoc markdown, using special nodes for config options and "Exports children of the curren node as pandoc markdown, using special nodes for config options and bibliography."
bibliography."
| markdownOutput | | markdownOutput |
markdownOutput := '' writeStream. markdownOutput := '' writeStream.