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,56 +507,77 @@ GrafoscopioNotebook >> notebookContent: aTree [
{ #category : #initialization } { #category : #initialization }
GrafoscopioNotebook >> notebookSubMenu [ GrafoscopioNotebook >> notebookSubMenu [
^ MenuModel new ^ MenuModel new
addGroup: [ :group | addGroup: [ :group |
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Save'; name: 'Save';
icon: (Smalltalk ui icons iconNamed: #smallSave); icon: (Smalltalk ui icons iconNamed: #smallSave);
shortcut: $s command; shortcut: $s command;
action: [ self saveWorkingNotebook ] ]. action: [ self saveWorkingNotebook ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Save as...'; name: 'Save as...';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs); icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self saveToFileUI ] ]. action: [ self saveToFileUI ] ].
group addItem: [ :item | 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 item
name: 'Export as markdown'; name: 'Export as markdown';
icon: (Smalltalk ui icons iconNamed: #smallSaveAs); icon: (Smalltalk ui icons iconNamed: #smallSaveAs);
action: [ self exportAsMarkdown ] ]. action: [ self exportAsMarkdown ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Export as html'; name: 'Export as html';
icon: (Smalltalk ui icons iconNamed: #smallWindow); icon: (Smalltalk ui icons iconNamed: #smallWindow);
action: [ self exportAsHTML ] ]. action: [ self exportAsHTML ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Export as LaTeX'; name: 'Export as LaTeX';
icon: (Smalltalk ui icons iconNamed: #smallPrint); icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsLaTeX ] ]. action: [ self exportAsLaTeX ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Export as pdf'; name: 'Export as pdf';
icon: (Smalltalk ui icons iconNamed: #smallPrint); icon: (Smalltalk ui icons iconNamed: #smallPrint);
action: [ self exportAsPDF ] ]. action: [ self exportAsPDF ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'See html'; name: 'See html';
icon: (Smalltalk ui icons iconNamed: #smallInspectIt); icon: #smallInspectIt asIcon;
action: [ self inform: 'To be implemented...' ] ]. action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'See pdf'; name: 'See pdf';
icon: (Smalltalk ui icons iconNamed: #smallInspectIt); icon: (Smalltalk ui icons iconNamed: #smallInspectIt);
action: [ self inform: 'To be implemented...' ] ]. action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'See images list'; name: 'See images list';
icon: (Smalltalk ui icons iconNamed: #glamorousTable); icon: (Smalltalk ui icons iconNamed: #processBrowser);
action: [ self listImagesUI ] ]. action: [ self listImagesUI ] ].
group addItem: [ :item | group
addItem: [ :item |
item item
name: 'Define debug message...'; name: 'Define debug message...';
icon: Smalltalk ui icons glamorousBug; icon: Smalltalk ui icons glamorousBug;

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