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 }
GrafoscopioDocs class >> openPDFManual [
"I open the documentation in PDF format."
| pdfManual docs |
docs := self newDefault.
pdfManual := docs documents at: 4.
WebBrowser openOn: (docs localPlace / pdfManual) fullName.
| pdfManual |
pdfManual := FileLocator imageDirectory asFileReference / 'Grafoscopio/Docs/En/Books/Manual/manual.pdf'.
WebBrowser openOn: pdfManual fullName.
]
{ #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.
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."
| pandocCommand |
| pandocCommonCommand |
self markdownFile exists ifFalse: [ self exportAsMarkdown ].
self pdfFile ensureDelete.
pandocCommand := 'cd ', self markdownFile parent fullName,'; ',
'pandoc ', self pandocOptionsComputed, ' ',
self markdownFile fullName, ' -o ', self pdfFile fullName.
Smalltalk platformName = 'unix' ifTrue: [ ExternalOSProcess command: pandocCommand ].
pandocCommonCommand := 'pandoc ', self pandocOptionsComputed, ' ', self markdownFile fullName,
' --output ', self pdfFile fullName.
Smalltalk platformName = 'unix'
ifTrue: [ ExternalOSProcess command: 'cd ', self markdownFile parent fullName,'; ', pandocCommonCommand ].
Smalltalk platformName = 'Win32'
ifTrue: [ WinProcess
createProcess: 'pandoc ', self pandocOptionsComputed, ' ',
self markdownFile fullName, ' -o ', self pdfFile fullName ].
ifTrue: [ WinProcess createProcess: pandocCommonCommand ].
self inform: ('File exported as: ', String cr, self pdfFile fullName)
]
@ -509,60 +507,81 @@ GrafoscopioNotebook >> notebookContent: aTree [
{ #category : #initialization }
GrafoscopioNotebook >> notebookSubMenu [
^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Save';
icon: (Smalltalk ui icons iconNamed: #smallSave);
shortcut: $s command;
action: [ self saveWorkingNotebook ] ].
group addItem: [ :item |
item
name: 'Save as...';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self saveToFileUI ] ].
group addItem: [ :item |
item
name: 'Export as markdown';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self exportAsMarkdown ] ].
group addItem: [ :item |
item
name: 'Export as html';
icon: (Smalltalk ui icons iconNamed: #smallWindow);
action: [ self exportAsHTML ]].
group addItem: [ :item |
item
name: 'Export as LaTeX';
icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsLaTeX ]].
group addItem: [ :item |
item
name: 'Export as pdf';
icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsPDF ] ].
group addItem: [ :item |
item
name: 'See html';
icon: (Smalltalk ui icons iconNamed: #smallInspectIt);
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: #glamorousTable);
action: [ self listImagesUI ]].
group addItem: [ :item |
item
name: 'Define debug message...';
icon: Smalltalk ui icons glamorousBug;
action: [ self defineDebugMessageUI ]]]
addGroup: [ :group |
group
addItem: [ :item |
item
name: 'Save';
icon: (Smalltalk ui icons iconNamed: #smallSave);
shortcut: $s command;
action: [ self saveWorkingNotebook ] ].
group
addItem: [ :item |
item
name: 'Save as...';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self saveToFileUI ] ].
group
addItem: [ :item |
item
name: 'Extract images';
icon: (Smalltalk ui icons iconNamed: #processBrowser);
action: [ self extractImages ] ].
group
addItem: [ :item |
item
name: 'Import images';
icon: (Smalltalk ui icons iconNamed: #processBrowser);
action: [ self importImages ] ].
group
addItem: [ :item |
item
name: 'Export as markdown';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self exportAsMarkdown ] ].
group
addItem: [ :item |
item
name: 'Export as html';
icon: (Smalltalk ui icons iconNamed: #smallWindow);
action: [ self exportAsHTML ] ].
group
addItem: [ :item |
item
name: 'Export as LaTeX';
icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsLaTeX ] ].
group
addItem: [ :item |
item
name: 'Export as pdf';
icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsPDF ] ].
group
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 }

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'
]