From d0b9885fdf087f0eee346d0dbc75ae069e495a65 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 15 Nov 2014 18:24:36 +0000 Subject: [PATCH] Exporting with pandoc as an external tool with path defined by the user. --- .../Grafoscopio/GrafoscopioBrowser.class.st | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 3f259db..323ed28 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -12,15 +12,16 @@ Class { #name : #GrafoscopioBrowser, #superclass : #Object, #instVars : [ - '\r\t\t\t\tbrowser', + 'browser', 'explorer', 'mainTree', 'workingFile', - '\r\t\t\t\tfossil', + 'fossil', 'localRepository', 'remoteRepository', 'repositoryUser', - 'repositoryPassword\r\t\t\t\tpandoc' + 'repositoryPassword', + 'pandoc' ], #classVars : [ 'DefaultUbakyeBrowser' @@ -202,6 +203,20 @@ browser on: $s entitled: 'Accept' with: [:text | text text ]]. ] +{ #category : #'system-support' } +GrafoscopioBrowser >> configurePandoc [ + "Stablish where is located pandoc according to the operative system and the input of the user" + | fileStream | + fileStream := UITheme builder + fileOpen: 'Coloque la ruta de pandoc'. + + fileStream isNil ifTrue: [ ^nil ]. + pandoc := fileStream name asFileReference fullName. + + + +] + { #category : #'system-support' } GrafoscopioBrowser >> configureSettings [ "Stablish several 'global' settings according to the operative system" @@ -256,13 +271,18 @@ GrafoscopioBrowser >> exportAsHtml [ | markdownFileLocation htmlFileLocation | markdownFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.markdown'. htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'. - Smalltalk platform name = 'unix' - ifTrue: [ OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]. - Smalltalk platform name = 'Win32' - ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]. - + pandoc notNil + ifTrue:[ + Smalltalk platform name = 'unix' + ifTrue: [ + OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation. + self inform: 'Archivo exportado como html'. ]. + Smalltalk platform name = 'Win32' + ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]] + ifFalse: [self configurePandoc ]. + self customKeys. - self inform: 'Archivo exportado como html'. + ] { #category : #persistence } @@ -300,12 +320,12 @@ GrafoscopioBrowser >> installPandoc [ ] -{ #category : #persistence } +{ #category : #'graphical interface' } GrafoscopioBrowser >> open [ "Opens a new browser with a default tree and assigns a default draft file for storing it. This is changed when the file is saved with the 'Save as' menu option" | draftsLocation | - self configureSettings. + "self configureSettings." self buildBrowser. mainTree := GrafoscopioNode new. mainTree becomeDefaultTree. @@ -511,6 +531,8 @@ GrafoscopioBrowser >> treeOn: constructor [ act: [self updateSystem] entitled: 'Grafoscopio > Actualizar'; act: [self updateSystem] entitled: 'Grafoscopio > Actualizar prerrequisitos'; act: [:x | x printString inspect] entitled: 'Grafoscopio > Actualizar herramientas externas'; + act: [self configurePandoc] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a pandoc'; + act: [:x | x printString inspect] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a fossil'; act: [:x | x printString inspect] entitled: 'Grafoscopio > Acerca de...'. ]