From 8e4b697ced53a3acc2bc3d96934a4b6f3c8b6d5b Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 10 Jul 2015 18:17:17 +0000 Subject: [PATCH] Better support for exporting to html using pandoc. --- .../Grafoscopio/GrafoscopioBrowser.class.st | 61 ++++++++++++------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index b798fdd..ded274f 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -175,13 +175,12 @@ GrafoscopioBrowser class >> openHelpInHtml [ | htmlHelpFileLocation | htmlHelpFileLocation := (FileSystem disk workingDirectory parent / 'Docs' /'Es' / 'Manual' / 'manual-grafoscopio.html') fullName. Smalltalk platform name = 'unix' - ifTrue: [ - OSProcess command: 'xdg-open ', htmlHelpFileLocation. - ]. + ifTrue: [OSProcess command: 'xdg-open ', htmlHelpFileLocation]. Smalltalk platform name = 'Win32' - ifTrue: [ - OSProcess command: 'explorer ', htmlHelpFileLocation. - ]. + ifTrue: [OSProcess command: 'explorer ', htmlHelpFileLocation]. + Smalltalk platform name = 'Mac OS' + ifTrue: [OSProcess command: 'open ', htmlHelpFileLocation]. + ] { #category : #'as yet unclassified' } @@ -191,13 +190,11 @@ GrafoscopioBrowser class >> openHelpInPdf [ | pdfHelpFileLocation | pdfHelpFileLocation := (FileSystem disk workingDirectory parent / 'Docs' /'Es' / 'Manual' / 'manual-grafoscopio.pdf') fullName. Smalltalk platform name = 'unix' - ifTrue: [ - OSProcess command: 'xdg-open ', pdfHelpFileLocation. - ]. + ifTrue: [OSProcess command: 'xdg-open ', pdfHelpFileLocation]. Smalltalk platform name = 'Win32' - ifTrue: [ - OSProcess command: 'explorer ', pdfHelpFileLocation. - ]. + ifTrue: [OSProcess command: 'explorer ', pdfHelpFileLocation]. + Smalltalk platform name = 'Mac OS' + ifTrue: [OSProcess command: 'open ', pdfHelpFileLocation]. ] { #category : #'as yet unclassified' } @@ -408,7 +405,7 @@ GrafoscopioBrowser class >> updateUI [ self startDockingBar. ] -{ #category : #persistence } +{ #category : #'persistance / repositories' } GrafoscopioBrowser >> addFileToRepository [ "Adds a selected file to a defined repository." @@ -423,7 +420,8 @@ GrafoscopioBrowser >> addFileToRepository [ OSProcess command: 'cd ', localRepository parent fullName, '; ', fossil, ' add ', fileToAdd, '; ', - 'echo "Added file to enabled repository"'. + 'echo "Added file to enabled repository"'. + self inform: 'Archivo adicionado al repositorio' ] { #category : #tags } @@ -758,7 +756,7 @@ GrafoscopioBrowser >> customKeys [ stream nextPutAll: bibStream contents withUnixLineEndings ]]. ] -{ #category : #persistence } +{ #category : #'persistance / repositories' } GrafoscopioBrowser >> defineRemoteRepository [ "Defines a remote fossil repository from an url" @@ -766,7 +764,7 @@ GrafoscopioBrowser >> defineRemoteRepository [ statements" ] -{ #category : #persistence } +{ #category : #'persistance / repositories' } GrafoscopioBrowser >> enableLocalRepository [ "Just a temporary message to enable working with fossil on a specific repository. This should be generalized" @@ -777,9 +775,12 @@ GrafoscopioBrowser >> enableLocalRepository [ extensions: #('fossil'). fileStream isNil ifTrue: [ ^nil ]. localRepository := fileStream name asFileReference. - OSProcess command: - 'cd ', localRepository parent fullName,';', - 'exec ', fossil, ' open ', localRepository fullName. + (Smalltalk platform name = 'unix') | (Smalltalk platform name = 'Mac OS') + ifTrue: [ + OSProcess command: + 'cd ', localRepository parent fullName,';', + 'exec ', fossil, ' open ', localRepository fullName. + self inform: 'Repositorio local abierto.']. ] { #category : #persistence } @@ -790,7 +791,7 @@ GrafoscopioBrowser >> exportAsHtml [ htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'. pandoc notNil ifTrue:[ - Smalltalk platform name = 'unix' + (Smalltalk platform name = 'unix') | (Smalltalk platform name = 'Mac OS') ifTrue: [ OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation. OSProcess command: 'exec echo "exportando como html"'. @@ -1352,7 +1353,7 @@ GrafoscopioBrowser >> treeOn: constructor [ act: [self saveToFileUI] entitled: 'Guardar como ...' categorized: 'Arbol'; act: [self saveWorkingTree; exportAsHtml] entitled: 'Exportar como HTML' categorized: 'Arbol'; act: [self saveWorkingTree; exportAsPdf] entitled: 'Exportar como PDF (requiere LaTeX)' categorized: 'Arbol'; - act: [self messageNotImplementedYet] entitled: 'Ver HTML' categorized: 'Arbol'; + act: [self viewExportedHtml] entitled: 'Ver HTML' categorized: 'Arbol'; act: [self messageNotImplementedYet] entitled: 'Ver PDF' categorized: 'Arbol'; "For nodes" @@ -1382,8 +1383,22 @@ GrafoscopioBrowser >> treeOn: constructor [ "For projects" act: [self enableLocalRepository] entitled: 'Activar repositorio local...' categorized: 'Proyecto'; - act: [self messageNotImplementedYet "addFileToRepository"] entitled: 'Agregar archivo' categorized: 'Proyecto'; - act: [self messageNotImplementedYet] entitled: 'Eliminar archivo' categorized: 'Proyecto'; + act: [self addFileToRepository] entitled: 'Agregar archivo...' categorized: 'Proyecto'; + act: [self messageNotImplementedYet] entitled: 'Eliminar archivo...' categorized: 'Proyecto'; act: [self messageNotImplementedYet "repositoryCommit"] entitled: 'Enviar al histórico' categorized: 'Proyecto'; act: [self messageNotImplementedYet "repositoryCredentials"] entitled: 'Acreditarse' categorized: 'Proyecto'. ] + +{ #category : #persistence } +GrafoscopioBrowser >> viewExportedHtml [ + "Exports the current tree to HTML, using the same name but different extension (.html)" + | htmlFileLocation | + htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'. + Smalltalk platform name = 'unix' + ifTrue: [OSProcess command: 'xdg-open ', htmlFileLocation]. + Smalltalk platform name = 'Win32' + ifTrue: [OSProcess command: 'explorer ', htmlFileLocation]. + Smalltalk platform name = 'Mac OS' + ifTrue: [OSProcess command: 'open ', htmlFileLocation]. + +]