Open PDF Manual fixed. New Pandoc object.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-12-06 16:48:02 +00:00
parent fdf7deb931
commit 222f164827
3 changed files with 129 additions and 65 deletions

View File

@ -33,10 +33,9 @@ GrafoscopioDocs class >> manual [
{ #category : #operation } { #category : #operation }
GrafoscopioDocs class >> openPDFManual [ GrafoscopioDocs class >> openPDFManual [
"I open the documentation in PDF format." "I open the documentation in PDF format."
| pdfManual docs | | pdfManual |
docs := self newDefault. pdfManual := FileLocator imageDirectory asFileReference / 'Grafoscopio/Docs/En/Books/Manual/manual.pdf'.
pdfManual := docs documents at: 4. WebBrowser openOn: pdfManual fullName.
WebBrowser openOn: (docs localPlace / pdfManual) fullName.
] ]
{ #category : #operation } { #category : #operation }

View File

@ -223,17 +223,15 @@ GrafoscopioNotebook >> exportAsPDF [
"I export the current tree/document to a PDF file, using pandoc and LaTeX external apps. "I export the current tree/document to a PDF file, using pandoc and LaTeX external apps.
The latex engine used is xelatex, to minimize errors and warnings related with UTF8 support. The latex engine used is xelatex, to minimize errors and warnings related with UTF8 support.
I suppose all them are already installed and defined in the system." I suppose all them are already installed and defined in the system."
| pandocCommand | | pandocCommonCommand |
self markdownFile exists ifFalse: [ self exportAsMarkdown ]. self markdownFile exists ifFalse: [ self exportAsMarkdown ].
self pdfFile ensureDelete. self pdfFile ensureDelete.
pandocCommand := 'cd ', self markdownFile parent fullName,'; ', pandocCommonCommand := 'pandoc ', self pandocOptionsComputed, ' ', self markdownFile fullName,
'pandoc ', self pandocOptionsComputed, ' ', ' --output ', self pdfFile fullName.
self markdownFile fullName, ' -o ', self pdfFile fullName. Smalltalk platformName = 'unix'
Smalltalk platformName = 'unix' ifTrue: [ ExternalOSProcess command: pandocCommand ]. ifTrue: [ ExternalOSProcess command: 'cd ', self markdownFile parent fullName,'; ', pandocCommonCommand ].
Smalltalk platformName = 'Win32' Smalltalk platformName = 'Win32'
ifTrue: [ WinProcess ifTrue: [ WinProcess createProcess: pandocCommonCommand ].
createProcess: 'pandoc ', self pandocOptionsComputed, ' ',
self markdownFile fullName, ' -o ', self pdfFile fullName ].
self inform: ('File exported as: ', String cr, self pdfFile fullName) self inform: ('File exported as: ', String cr, self pdfFile fullName)
] ]
@ -509,60 +507,81 @@ GrafoscopioNotebook >> notebookContent: aTree [
{ #category : #initialization } { #category : #initialization }
GrafoscopioNotebook >> notebookSubMenu [ GrafoscopioNotebook >> notebookSubMenu [
^ MenuModel new ^ MenuModel new
addGroup: [ :group | addGroup: [ :group |
group addItem: [ :item | group
item addItem: [ :item |
name: 'Save'; item
icon: (Smalltalk ui icons iconNamed: #smallSave); name: 'Save';
shortcut: $s command; icon: (Smalltalk ui icons iconNamed: #smallSave);
action: [ self saveWorkingNotebook ] ]. shortcut: $s command;
group addItem: [ :item | action: [ self saveWorkingNotebook ] ].
item group
name: 'Save as...'; addItem: [ :item |
icon: (Smalltalk ui icons iconNamed: #smallSaveAs); item
action: [ self saveToFileUI ] ]. name: 'Save as...';
group addItem: [ :item | icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
item action: [ self saveToFileUI ] ].
name: 'Export as markdown'; group
icon: (Smalltalk ui icons iconNamed: #smallSaveAs); addItem: [ :item |
action: [ self exportAsMarkdown ] ]. item
group addItem: [ :item | name: 'Extract images';
item icon: (Smalltalk ui icons iconNamed: #processBrowser);
name: 'Export as html'; action: [ self extractImages ] ].
icon: (Smalltalk ui icons iconNamed: #smallWindow); group
action: [ self exportAsHTML ]]. addItem: [ :item |
group addItem: [ :item | item
item name: 'Import images';
name: 'Export as LaTeX'; icon: (Smalltalk ui icons iconNamed: #processBrowser);
icon: (Smalltalk ui icons iconNamed: #smallPrint); action: [ self importImages ] ].
action: [ self exportAsLaTeX ]]. group
group addItem: [ :item | addItem: [ :item |
item item
name: 'Export as pdf'; name: 'Export as markdown';
icon: (Smalltalk ui icons iconNamed: #smallPrint); icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self exportAsPDF ] ]. action: [ self exportAsMarkdown ] ].
group addItem: [ :item | group
item addItem: [ :item |
name: 'See html'; item
icon: (Smalltalk ui icons iconNamed: #smallInspectIt); name: 'Export as html';
action: [ self inform: 'To be implemented...']]. icon: (Smalltalk ui icons iconNamed: #smallWindow);
group addItem: [ :item | action: [ self exportAsHTML ] ].
item group
name: 'See pdf'; addItem: [ :item |
icon: (Smalltalk ui icons iconNamed: #smallInspectIt); item
action: [ self inform: 'To be implemented...' ]]. name: 'Export as LaTeX';
group addItem: [ :item | icon: (Smalltalk ui icons iconNamed: #smallPrint);
item action: [ self exportAsLaTeX ] ].
name: 'See images list'; group
icon: (Smalltalk ui icons iconNamed: #glamorousTable); addItem: [ :item |
action: [ self listImagesUI ]]. item
group addItem: [ :item | name: 'Export as pdf';
item icon: (Smalltalk ui icons iconNamed: #smallPrint);
name: 'Define debug message...'; action: [ self exportAsPDF ] ].
icon: Smalltalk ui icons glamorousBug; group
action: [ self defineDebugMessageUI ]]] addItem: [ :item |
item
name: 'See html';
icon: #smallInspectIt asIcon;
action: [ self inform: 'To be implemented...' ] ].
group
addItem: [ :item |
item
name: 'See pdf';
icon: (Smalltalk ui icons iconNamed: #smallInspectIt);
action: [ self inform: 'To be implemented...' ] ].
group
addItem: [ :item |
item
name: 'See images list';
icon: (Smalltalk ui icons iconNamed: #processBrowser);
action: [ self listImagesUI ] ].
group
addItem: [ :item |
item
name: 'Define debug message...';
icon: Smalltalk ui icons glamorousBug;
action: [ self defineDebugMessageUI ] ] ]
] ]
{ #category : #private } { #category : #private }

View File

@ -0,0 +1,46 @@
"
I model the interaction between Pandoc and Grafoscopio.
"
Class {
#name : #Pandoc,
#superclass : #Object,
#classInstVars : [
'executable'
],
#category : #'Grafoscopio-Model'
}
{ #category : #accessing }
Pandoc class >> executable [
^ executable ifNil: [ self executableLocation ]
]
{ #category : #accessing }
Pandoc class >> executable: aFileReference [
executable := aFileReference
]
{ #category : #accessing }
Pandoc class >> executableLocation [
| location |
location := '/usr/bin/pandoc'.
location asFileReference exists
ifTrue: [ ^ location ]
ifFalse: [ self definePandocExecutable ]
]
{ #category : #utility }
Pandoc class >> luaFilters [
"I define the location of set of scripts, that allows to change the default behaviour of Pandoc
and/or the processing of supported markup languages.
For more information about Lua filters see:
https://pandoc.org/lua-filters.html
"
| filters |
filters := OrderedCollection new.
filters
add: 'http://mutabit.com/repos.fossil/dataweek/doc/tip/Artefactos/Scripts/links.lua'
]