Support for pdf exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2015-03-06 17:44:17 +00:00
parent e48afbe15a
commit 38f078dbd2

View File

@ -360,15 +360,15 @@ GrafoscopioBrowser >> configureSettings [
Smalltalk platform name = 'unix'
ifTrue: [
fossil := (FileSystem disk workingDirectory / 'Platform' / 'Linux' / 'Programs' / 'Fossil' / 'fossil') fullName.
pandoc := (FileSystem disk workingDirectory / 'Platform' / 'Linux' / 'Programs' / 'Pandoc' / 'pandoc') fullName.
fossil := (FileSystem disk workingDirectory parent / 'Platform' / 'Linux' / 'Programs' / 'Fossil' / 'fossil') fullName.
pandoc := (FileSystem disk workingDirectory parent / 'Platform' / 'Linux' / 'Programs' / 'Pandoc' / 'pandoc') fullName.
].
Smalltalk platform name = 'Win32'
ifTrue: [
fossil := (FileSystem disk workingDirectory / 'Platform' / 'Windows' / 'Programs' / 'Fossil' / 'fossil.exe') fullName.
pandoc := (FileSystem disk workingDirectory / 'Platform' / 'Windows' / 'Programs' / 'Pandoc' / 'pandoc.exe') fullName. ].
localRepository := (FileSystem disk workingDirectory / 'Grafoscopio' / 'Projects' / 'SoftwareLibre-Educacion' / 'soliedu.fossil').
remoteRepository := 'http://mutabit.com/deltas/repos.fossil/soliedu'.
fossil := (FileSystem disk workingDirectory parent / 'Platform' / 'Windows' / 'Programs' / 'Fossil' / 'fossil.exe') fullName.
pandoc := (FileSystem disk workingDirectory parent / 'Platform' / 'Windows' / 'Programs' / 'Pandoc' / 'pandoc.exe') fullName. ].
"localRepository := (FileSystem disk workingDirectory / 'Grafoscopio' / 'Projects' / 'SoftwareLibre-Educacion' / 'soliedu.fossil').
remoteRepository := 'http://mutabit.com/deltas/repos.fossil/soliedu'".
]
{ #category : #persistence }
@ -453,6 +453,29 @@ GrafoscopioBrowser >> exportAsMarkdown: aTree on: locator [
]
{ #category : #persistence }
GrafoscopioBrowser >> exportAsPdf [
"Exports the current tree to HTML, using the same name but different extension (.pdf).
IMPORTANT: The user needs to have installed TeX to create the pdf."
| markdownFileLocation pdfFileLocation |
markdownFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.markdown'.
pdfFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.pdf'.
pandoc notNil
ifTrue:[
Smalltalk platform name = 'unix'
ifTrue: [
OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' -o ' , pdfFileLocation.
OSProcess command: 'exec echo "exportando como html"'.
self inform: 'Archivo exportado como pdf en: ', pdfFileLocation.
self inform: pandoc].
Smalltalk platform name = 'Win32'
ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , pdfFileLocation ]]
ifFalse: [self configurePandoc ].
self customKeys.
]
{ #category : #persistence }
GrafoscopioBrowser >> exportAsSton: aTree on: locator [
@ -937,6 +960,7 @@ GrafoscopioBrowser >> treeOn: constructor [
act: [GrafoscopioBrowser new openFromFileSelector] entitled: 'Abrir/Cargar ...' categorized: 'Arbol';
act: [self saveToFile] entitled: 'Guardar como ...' categorized: 'Arbol';
act: [self exportAsHtml] entitled: 'Exportar como html' categorized: 'Arbol';
act: [self exportAsPdf] entitled: 'Exportar como pdf' categorized: 'Arbol';
"For nodes"
act: [:treePresentation |
@ -952,27 +976,23 @@ GrafoscopioBrowser >> treeOn: constructor [
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [self addTagTo: treePresentation selection]]
entitled: 'Agregar al nodo' categorized: 'Etiquetas';
entitled: 'Etiquetar nodo como...' categorized: 'Etiquetas';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [
treePresentation selection tagAs: nil.
browser update.
]]
entitled: 'Eliminar del nodo' categorized: 'Etiquetas';
entitled: 'Desetiquetar nodo como...' categorized: 'Etiquetas';
act: [self showTagsAvailable] entitled: 'Ver disponibles' categorized: 'Etiquetas';
act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas';
"For projects"
act: [self enableRepository] entitled: 'Activar' categorized: 'Proyecto';
act: [self addFileToRepository] entitled: 'Agregar archivo' categorized: 'Proyecto';
act: [self messageNotImplementedYet "enableRepository"] entitled: 'Activar' categorized: 'Proyecto';
act: [self messageNotImplementedYet "addFileToRepository"] entitled: 'Agregar archivo' categorized: 'Proyecto';
act: [self messageNotImplementedYet] entitled: 'Eliminar archivo' categorized: 'Proyecto';
act: [self repositoryCommit] entitled: 'Enviar al histórico' categorized: 'Proyecto';
act: [self repositoryCredentials] entitled: 'Acreditarse' categorized: 'Proyecto';
"For modes"
act: [GrafoscopioBrowser new openFromFile: workingFile fullName asFileReference] entitled: 'Predeterminado' categorized: 'Modos';
act: [self buildBrowserNamed: workingFile inMode: 'transmedia'] entitled: 'Transmedia' categorized: 'Modos';
act: [self messageNotImplementedYet "repositoryCommit"] entitled: 'Enviar al histórico' categorized: 'Proyecto';
act: [self messageNotImplementedYet "repositoryCredentials"] entitled: 'Acreditarse' categorized: 'Proyecto';
"For help"
act: [self messageNotImplementedYet] entitled: 'Ver como html en línea' categorized: 'Ayuda';