Exporting with pandoc as an external tool with path defined by the user.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2014-11-15 18:24:36 +00:00
parent 24d3a70390
commit d0b9885fdf

View File

@ -12,15 +12,16 @@ Class {
#name : #GrafoscopioBrowser, #name : #GrafoscopioBrowser,
#superclass : #Object, #superclass : #Object,
#instVars : [ #instVars : [
'\r\t\t\t\tbrowser', 'browser',
'explorer', 'explorer',
'mainTree', 'mainTree',
'workingFile', 'workingFile',
'\r\t\t\t\tfossil', 'fossil',
'localRepository', 'localRepository',
'remoteRepository', 'remoteRepository',
'repositoryUser', 'repositoryUser',
'repositoryPassword\r\t\t\t\tpandoc' 'repositoryPassword',
'pandoc'
], ],
#classVars : [ #classVars : [
'DefaultUbakyeBrowser' 'DefaultUbakyeBrowser'
@ -202,6 +203,20 @@ browser
on: $s entitled: 'Accept' with: [:text | text text ]]. 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' } { #category : #'system-support' }
GrafoscopioBrowser >> configureSettings [ GrafoscopioBrowser >> configureSettings [
"Stablish several 'global' settings according to the operative system" "Stablish several 'global' settings according to the operative system"
@ -256,13 +271,18 @@ GrafoscopioBrowser >> exportAsHtml [
| markdownFileLocation htmlFileLocation | | markdownFileLocation htmlFileLocation |
markdownFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.markdown'. markdownFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.markdown'.
htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'. htmlFileLocation := ((workingFile parent) / workingFile basenameWithoutExtension) fullName, '.html'.
pandoc notNil
ifTrue:[
Smalltalk platform name = 'unix' Smalltalk platform name = 'unix'
ifTrue: [ OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]. ifTrue: [
OSProcess command: 'exec ', pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation.
self inform: 'Archivo exportado como html'. ].
Smalltalk platform name = 'Win32' Smalltalk platform name = 'Win32'
ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]. ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ]]
ifFalse: [self configurePandoc ].
self customKeys. self customKeys.
self inform: 'Archivo exportado como html'.
] ]
{ #category : #persistence } { #category : #persistence }
@ -300,12 +320,12 @@ GrafoscopioBrowser >> installPandoc [
] ]
{ #category : #persistence } { #category : #'graphical interface' }
GrafoscopioBrowser >> open [ GrafoscopioBrowser >> open [
"Opens a new browser with a default tree and assigns a default draft file for storing it. "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" This is changed when the file is saved with the 'Save as' menu option"
| draftsLocation | | draftsLocation |
self configureSettings. "self configureSettings."
self buildBrowser. self buildBrowser.
mainTree := GrafoscopioNode new. mainTree := GrafoscopioNode new.
mainTree becomeDefaultTree. mainTree becomeDefaultTree.
@ -511,6 +531,8 @@ GrafoscopioBrowser >> treeOn: constructor [
act: [self updateSystem] entitled: 'Grafoscopio > Actualizar'; act: [self updateSystem] entitled: 'Grafoscopio > Actualizar';
act: [self updateSystem] entitled: 'Grafoscopio > Actualizar prerrequisitos'; act: [self updateSystem] entitled: 'Grafoscopio > Actualizar prerrequisitos';
act: [:x | x printString inspect] entitled: 'Grafoscopio > Actualizar herramientas externas'; 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...'. act: [:x | x printString inspect] entitled: 'Grafoscopio > Acerca de...'.
] ]