JOSS article: Fixing installation problems.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-04-28 15:41:04 +00:00
parent c03e827e50
commit 6d86c83c62
5 changed files with 80 additions and 42 deletions

View File

@ -368,7 +368,6 @@ GrafoscopioBrowser >> openFromFile: aFileName [
mainTree := GrafoscopioNode new
header: (currentChildren at: 1) parent header;
level: (currentChildren at: 1) parent level;
metadata: (currentChildren at: 1) parent metadata;
children: currentChildren.
browser openOn: mainTree children.
]
@ -395,7 +394,6 @@ GrafoscopioBrowser >> openFromFileSelector [
mainTree := GrafoscopioNode new
header: (currentChildren at: 1) parent header;
level: (currentChildren at: 1) parent level;
metadata: (currentChildren at: 1) parent metadata;
children: currentChildren.
browser openOn: mainTree children.
]

View File

@ -88,9 +88,11 @@ GrafoscopioDocumentation class >> listOutdated [
]
{ #category : #updating }
GrafoscopioDocumentation class >> listOutdatedDocsIn: aDocumentsName [
GrafoscopioDocumentation class >> listOutdatedDocsIn: aDocumentsListName [
"I return the list of all documentent where the local copy and the remote copy doesn't match"
^ (self perform: aDocumentsName asSymbol) documents reject: [ :doc | (self isFileUpdatedFor: doc) ]
aDocumentsListName ifNil: [ ^ self ].
aDocumentsListName ifEmpty: [ ^ self ].
^ (self perform: aDocumentsListName asSymbol) documents reject: [ :doc | (self isFileUpdatedFor: doc) ]
]
{ #category : #updating }

View File

@ -23,7 +23,6 @@ Class {
'node',
'level',
'nodesInPreorder',
'metadata',
'links',
'output'
],
@ -176,13 +175,12 @@ GrafoscopioNode >> asMarkdown [
| markdownOutput |
markdownOutput := '' writeStream.
self exportPreambleTo: markdownOutput.
self metadataAsYamlIn: markdownOutput.
(self preorderTraversal) do: [ :eachNode |
(eachNode level > 0)
ifTrue: [(eachNode hasAncestorTaggedAs: 'invisible') | (eachNode tags = 'invisible')
ifFalse: [ markdownOutput nextPutAll: (eachNode markdownContent) ]]].
^markdownOutput contents
]
{ #category : #exporting }
@ -262,9 +260,9 @@ GrafoscopioNode >> bodyAsCode [
| codeBody |
codeBody := '' writeStream.
codeBody
nextPutAll: ('~~~{.numberLines}'); lf;
nextPutAll: '~~~{.numberLines}'; lf;
nextPutAll: (self body contents asString withInternetLineEndings); lf;
nextPutAll: ('~~~'); lf; lf.
nextPutAll: '~~~'; lf; lf.
^ codeBody contents
]
@ -383,7 +381,7 @@ GrafoscopioNode >> exportCodeBlockTo: aStream [
GrafoscopioNode >> exportCodeNodeTo: aStream [
"I convert the content of a node taged as 'código' (code) as pandoc markdown and put it
into aStream."
(self headerStartsWith: '%output')
((self headerStartsWith: '%output') or: [ self headerStartsWith: '%metadata' ])
ifTrue: [ self exportCodeOutputTo: aStream ]
ifFalse: [ self exportCodeBlockTo: aStream ]
]
@ -392,8 +390,9 @@ GrafoscopioNode >> exportCodeNodeTo: aStream [
GrafoscopioNode >> exportCodeOutputTo: aStream [
"I convert the output of a node taged as 'código' (code) as pandoc markdown and put it
into aStream."
(self headerStartsWith: '%metadata') ifTrue: [ ^ self ].
aStream nextPutAll: ('~~~{.numberLines}'); lf.
aStream nextPutAll: ((Compiler evaluate: self body) asString withInternetLineEndings); lf.
aStream nextPutAll: (self output asString withInternetLineEndings); lf.
aStream nextPutAll: ('~~~'); lf;lf.
^aStream contents
]
@ -551,9 +550,14 @@ GrafoscopioNode >> key: aUniqueKey [
{ #category : #accessing }
GrafoscopioNode >> lastLink [
links ifNil: [ ^ '' ].
links ifEmpty: [ ^ '' ].
^ links last
self links ifNil: [ ^ '' ].
self links ifEmpty: [ ^ '' ].
^ self links last
]
{ #category : #accessing }
GrafoscopioNode >> lastNetLink [
^ self links detect: [ :l | l asZnUrl isURL ]
]
{ #category : #accessing }
@ -585,14 +589,24 @@ GrafoscopioNode >> links: anObject [
{ #category : #operation }
GrafoscopioNode >> linksToMarkdownFile [
"I detect if the links contains any reference to a file ending in '.md' or '.markdown'"
self links ifNotNil: [
self links
detect: [:l | (l endsWith: '.md') or: [ l endsWith: '.markdown']]
ifFound: [ ^ true ]
ifNone: [^ false]]
self links
ifNotNil: [
self links
detect: [:l | (l endsWith: '.md') or: [ l endsWith: '.markdown']]
ifFound: [ ^ true ]
ifNone: [^ false]].
^ false
]
{ #category : #operation }
GrafoscopioNode >> localFilesLinks [
"I collect all the links that point to the local file system. Because is supposed that
links contains only references to remote URL or local files, anything that is not a URL is
treated as a loca file link."
^ self links reject: [ :l | l asZnUrl isURL ]
]
{ #category : #exporting }
GrafoscopioNode >> margin [
"I define the same margin of the page used for PDF exportations"
@ -635,14 +649,28 @@ GrafoscopioNode >> markdownContent [
^ markdownStream contents
]
{ #category : #accessing }
{ #category : #operation }
GrafoscopioNode >> metadata [
^ metadata
| mnode |
mnode := self root preorderTraversal detect: [:n | n headerStartsWith: '%metadata' ].
^ mnode output.
]
{ #category : #accessing }
GrafoscopioNode >> metadata: anObject [
metadata := anObject
{ #category : #exporting }
GrafoscopioNode >> metadataAsYamlIn: markdownStream [
"I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation."
markdownStream
nextPutAll: '---';
lf.
self metadata
keysAndValuesDo: [ :k :v |
markdownStream
nextPutAll: (k , ': ' , v asString) withInternetLineEndings;
nextPutAll: String cr ].
markdownStream
nextPutAll: '---';
lf; lf
]
{ #category : #movement }
@ -683,7 +711,9 @@ GrafoscopioNode >> newNode [
{ #category : #accessing }
GrafoscopioNode >> output [
^ output
self tags ~= 'código' ifTrue: [ ^ self ].
self body ifNil: [ ^ nil ].
^ (Compiler evaluate: self body)
]
{ #category : #accessing }
@ -691,6 +721,11 @@ GrafoscopioNode >> output: anObject [
output := anObject
]
{ #category : #utility }
GrafoscopioNode >> pandocOptions [
^ self metadata at: 'pandocOptions' ifAbsent: [ ^ '' ]
]
{ #category : #accessing }
GrafoscopioNode >> parent [
"Returns the parent of the current node"
@ -715,20 +750,13 @@ GrafoscopioNode >> pasteFromClipboard [
]
{ #category : #exporting }
{ #category : #operation }
GrafoscopioNode >> preorderTraversal [
nodesInPreorder := OrderedCollection new.
self visitedGoTo: nodesInPreorder.
^ nodesInPreorder.
]
{ #category : #accessing }
GrafoscopioNode >> processOutput [
(self headerStartsWith: '%output')
ifFalse: [ ^ self ].
^ self output: (Compiler evaluate: self body)
]
{ #category : #movement }
GrafoscopioNode >> promote [
"Moves the current node up in the hierachy, making it a slibing of its current parent"
@ -787,10 +815,10 @@ GrafoscopioNode >> removeNode: aNode [
{ #category : #accessing }
GrafoscopioNode >> root [
"I return the node of the Grafoscopio tree that contains the receiver"
"I return the root node of the Grafoscopio tree, i.e the common ancestor of all other nodes"
self level = 0
ifTrue: [ ^ self ]
ifFalse: [ ^ self ancestors first. ]
ifFalse: [ ^ self ancestors first ].
^ self
]
{ #category : #accessing }
@ -838,8 +866,9 @@ GrafoscopioNode >> title [
{ #category : #operation }
GrafoscopioNode >> visitLastLink [
links ifNil: [ self inform: 'This node has no associated links to visit'. ^ self ].
[WebBrowser openOn: self lastLink] fork.
self lastLink = ''
ifTrue: [ self inform: 'This node has no associated links to visit'. ^ self ].
[WebBrowser openOn: self lastLink] fork
]
{ #category : #'add/remove nodes' }

View File

@ -146,12 +146,16 @@ 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."
| pdfFile |
| pdfFile pandocCommand |
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).
pandocCommand := 'pandoc ',
self notebook pandocOptions, ' ',
self markdownFile fullName, ' -o ', pdfFile.
Transcript show: pandocCommand.
ExternalUnixOSProcess command: pandocCommand.
self inform: ('File exported as: ', String cr, pdfFile)
]
{ #category : #persistence }

View File

@ -22,6 +22,11 @@ ManifestGrafoscopio class >> ruleRBBooleanPrecedenceRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#'GrafoscopioNode class' #cleanTreeRootReferences #true)) #'2017-03-27T22:18:17.447627-05:00') )
]
{ #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBCascadedNextPutAllsRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#GrafoscopioNode #metadataAsYamlIn: #false)) #'2017-04-20T19:01:59.286212-05:00') )
]
{ #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBClassNameInSelectorRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#'Documentation class' #current #true)) #'2016-10-07T19:39:23.013722-05:00') )