%footnotes and code blocks improved.
This commit is contained in:
parent
491b7d4de9
commit
c3986692be
@ -180,7 +180,6 @@ GrafoscopioNode >> asMarkdown [
|
||||
(eachNode level > 0)
|
||||
ifTrue: [(eachNode hasAncestorTaggedAs: 'invisible') | (eachNode tags = 'invisible')
|
||||
ifFalse: [ markdownOutput nextPutAll: (eachNode markdownContent) ]]].
|
||||
|
||||
^markdownOutput contents
|
||||
|
||||
]
|
||||
@ -263,7 +262,7 @@ GrafoscopioNode >> bodyAsCode [
|
||||
codeBody
|
||||
nextPutAll: ('~~~'); lf;
|
||||
nextPutAll: (self body contents asString withInternetLineEndings); lf;
|
||||
nextPutAll: ('~~~'); lf.
|
||||
nextPutAll: ('~~~'); lf; lf.
|
||||
^ codeBody contents
|
||||
]
|
||||
|
||||
@ -374,7 +373,7 @@ GrafoscopioNode >> exportCodeBlockTo: aStream [
|
||||
into aStream."
|
||||
aStream nextPutAll: ('~~~'); lf.
|
||||
aStream nextPutAll: (self body contents asString withInternetLineEndings); lf.
|
||||
aStream nextPutAll: ('~~~'); lf.
|
||||
aStream nextPutAll: ('~~~'); lf;lf.
|
||||
^aStream contents
|
||||
]
|
||||
|
||||
@ -439,7 +438,8 @@ GrafoscopioNode >> footnoteAsMarkdownInto: aStream [
|
||||
and replace all line endings to make them Internet friendly.
|
||||
Maybe I should include the condition about my own header, instead of leaving it to markdownCotent..."
|
||||
aStream nextPutAll: ('[^',(self header copyReplaceAll: '%footnote ' with: ''),']: ' ); lf.
|
||||
aStream nextPutAll: (self body contents withInternetLineEndings); lf; lf.
|
||||
self body contents withInternetLineEndings linesDo: [ :line | aStream nextPutAll: ' ', line; lf ].
|
||||
aStream nextPutAll: String lf.
|
||||
|
||||
]
|
||||
|
||||
|
@ -95,6 +95,19 @@ GrafoscopioNotebook >> demoteNode [
|
||||
self notebookContent: notebook.
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportAsHTML [
|
||||
"I export the current tree/document to a HTML file, using pandoc external app.
|
||||
I suppose pandoc is already installed and available in the system."
|
||||
| htmlFile |
|
||||
self markdownFile exists ifTrue: [ self markdownFile delete ].
|
||||
self exportAsMarkdown.
|
||||
htmlFile := self markdownFile parent fullName,'/', self markdownFile basenameWithoutExtension, '.html'.
|
||||
htmlFile asFileReference exists ifTrue: [ htmlFile asFileReference delete ].
|
||||
OSProcess command: 'pandoc --standalone ', self markdownFile fullName, ' -o ', htmlFile.
|
||||
self inform: ('File exported as: ', String cr, htmlFile).
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportAsLaTeX [
|
||||
"I export the current tree/document to a LaTeX file, using pandoc external app.
|
||||
@ -103,7 +116,8 @@ GrafoscopioNotebook >> exportAsLaTeX [
|
||||
self markdownFile exists ifTrue: [ self markdownFile delete ].
|
||||
self exportAsMarkdown.
|
||||
texFile := self markdownFile parent fullName,'/', self markdownFile basenameWithoutExtension, '.tex'.
|
||||
OSProcess command: "Transcript show:" 'pandoc --standalone ', self markdownFile fullName, ' -o ', texFile.
|
||||
texFile asFileReference exists ifTrue: [ texFile asFileReference delete ].
|
||||
OSProcess command: 'pandoc --standalone ', self markdownFile fullName, ' -o ', texFile.
|
||||
self inform: ('File exported as: ', String cr, texFile).
|
||||
]
|
||||
|
||||
@ -129,6 +143,7 @@ GrafoscopioNotebook >> exportAsPDF [
|
||||
| pdfFile |
|
||||
self markdownFile exists ifFalse: [ self exportAsMarkdown ].
|
||||
pdfFile := self markdownFile parent fullName,'/', self markdownFile basenameWithoutExtension, '.pdf'.
|
||||
pdfFile asFileReference exists ifTrue: [ pdfFile asFileReference delete ].
|
||||
OSProcess command: 'pandoc --latex-engine=xelatex ', self markdownFile fullName, ' -o ', pdfFile.
|
||||
self inform: ('File exported as: ', String cr, pdfFile).
|
||||
]
|
||||
@ -396,12 +411,12 @@ GrafoscopioNotebook >> notebookSubMenu [
|
||||
item
|
||||
name: 'Export as html';
|
||||
icon: Smalltalk ui icons smallWindowIcon;
|
||||
action: [ self inform: 'To be implemented...' ] ].
|
||||
action: [ self exportAsHTML ]].
|
||||
group addItem: [ :item |
|
||||
item
|
||||
name: 'Export as LaTeX';
|
||||
icon: Smalltalk ui icons smallPrintIcon;
|
||||
action: [ self exportAsLaTeX ] ].
|
||||
action: [ self exportAsLaTeX ]].
|
||||
group addItem: [ :item |
|
||||
item
|
||||
name: 'Export as pdf';
|
||||
@ -411,12 +426,12 @@ GrafoscopioNotebook >> notebookSubMenu [
|
||||
item
|
||||
name: 'See html';
|
||||
icon: Smalltalk ui icons smallInspectItIcon;
|
||||
action: [ self inform: 'To be implemented...' ] ].
|
||||
action: [ self inform: 'To be implemented...']].
|
||||
group addItem: [ :item |
|
||||
item
|
||||
name: 'See pdf';
|
||||
icon: Smalltalk ui icons smallInspectItIcon;
|
||||
action: [ self inform: 'To be implemented...' ] ] ]
|
||||
action: [ self inform: 'To be implemented...' ]]]
|
||||
]
|
||||
|
||||
{ #category : #private }
|
||||
|
Loading…
Reference in New Issue
Block a user