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,
#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'.
pandoc notNil
ifTrue:[
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'
ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' --standalone -o ' , htmlFileLocation ].
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...'.
]