Flatten nodes at least!!! Now we have small files for grafoscopio notebooks. The start of a DVCS friendly grafoscopio notebook format :-). This should be reflected in the grafoscopio Docs folder of the fossil repo at http://mutabit.com/repos.fossil/grafoscopio/ after commit [6440630201]
This commit is contained in:
parent
a6bf43ab04
commit
4d835b3f58
@ -204,7 +204,7 @@ GrafoscopioBrowser class >> openFromRecentlyUsed [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
{ #category : #'graphical interface' }
|
||||
GrafoscopioBrowser class >> openHelpInHtml [
|
||||
"Launches the help manual in PDF format in an external viewer."
|
||||
|
||||
@ -219,7 +219,7 @@ GrafoscopioBrowser class >> openHelpInHtml [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
{ #category : #'graphical interface' }
|
||||
GrafoscopioBrowser class >> openHelpInPdf [
|
||||
"Launches the help manual in PDF format in an external viewer."
|
||||
|
||||
@ -233,7 +233,7 @@ GrafoscopioBrowser class >> openHelpInPdf [
|
||||
ifTrue: [OSProcess command: 'open ', pdfHelpFileLocation].
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
{ #category : #configuration }
|
||||
GrafoscopioBrowser class >> showSettings [
|
||||
"Shows the settings in a Transcript. This should return a dictionary for better management of the settings. For the moment
|
||||
is a quick a dirty hack"
|
||||
@ -745,7 +745,6 @@ GrafoscopioBrowser >> exportAsHtml [
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioBrowser >> exportAsMarkdown: aTree on: locator [
|
||||
|
||||
locator writeStreamDo: [:stream | stream nextPutAll: aTree asMarkdown]
|
||||
|
||||
]
|
||||
@ -774,7 +773,7 @@ GrafoscopioBrowser >> exportAsPdf [
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioBrowser >> exportAsSton: aTree on: locator [
|
||||
|
||||
aTree flatten.
|
||||
locator nextPutAll: (STON toStringPretty: aTree children)
|
||||
]
|
||||
|
||||
@ -1007,6 +1006,7 @@ GrafoscopioBrowser >> saveToFile: aFileReference [
|
||||
writeStream := file writeStream.
|
||||
workingFile := writeStream name asFileReference.
|
||||
markdownFile := (workingFile parent) / (workingFile basenameWithoutExtension, '.markdown').
|
||||
markdownFile ensureCreateFile.
|
||||
[ self exportAsSton: mainTree on: writeStream.
|
||||
self exportAsMarkdown: mainTree on: markdownFile ]
|
||||
ensure: [ writeStream ifNotNil: #close ].
|
||||
@ -1036,13 +1036,15 @@ GrafoscopioBrowser >> saveToFileUI [
|
||||
GrafoscopioBrowser >> saveWorkingTree [
|
||||
"Saves the current tree to the user predefined file location used when he/she opened it."
|
||||
|
||||
| fileStream markdownFile |
|
||||
fileStream := workingFile writeStream.
|
||||
| markdownFile |
|
||||
markdownFile := (workingFile parent) / (workingFile basenameWithoutExtension, '.markdown').
|
||||
[ self exportAsSton: mainTree on: fileStream.
|
||||
self exportAsMarkdown: mainTree on: markdownFile ]
|
||||
ensure: [ fileStream ifNotNil: #close.].
|
||||
"self customKeys."
|
||||
markdownFile exists ifTrue: [ markdownFile delete ].
|
||||
markdownFile ensureCreateFile.
|
||||
workingFile exists ifTrue: [ workingFile delete ].
|
||||
workingFile ensureCreateFile.
|
||||
[ self exportAsSton: mainTree on: (workingFile writeStream).
|
||||
self exportAsMarkdown: mainTree on: markdownFile
|
||||
] ensure: [ (workingFile writeStream) ifNotNil: #close.].
|
||||
self inform: 'Archivo guardado como: ', workingFile asString.
|
||||
]
|
||||
|
||||
|
@ -121,7 +121,8 @@ GrafoscopioNode >> ancestorsHeaders [
|
||||
|
||||
{ #category : #exporting }
|
||||
GrafoscopioNode >> asMarkdown [
|
||||
"Exports children of the current node as pandoc markdown, using special nodes accoding to tags"
|
||||
"I export children of the current node as pandoc markdown, using special nodes accoding to tags.
|
||||
Early version... tags processing should be vastly improved"
|
||||
| markdownOutput |
|
||||
|
||||
markdownOutput := '' writeStream.
|
||||
@ -140,6 +141,7 @@ GrafoscopioNode >> asSton [
|
||||
| stonOutput |
|
||||
|
||||
stonOutput := '' writeStream.
|
||||
self flatten.
|
||||
stonOutput nextPutAll: (STON toStringPretty: self children).
|
||||
^stonOutput contents
|
||||
|
||||
@ -233,6 +235,17 @@ GrafoscopioNode >> demote [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #exporting }
|
||||
GrafoscopioNode >> flatten [
|
||||
"I traverse the tree looking for node bodies containing 'Text' objects and transform them to
|
||||
their string content, so space is saved and storage format is DVCS friendly while serializing them to STON"
|
||||
|
||||
(self preorderTraversal) do: [ :eachNode |
|
||||
(eachNode body class = Text)
|
||||
ifTrue: [eachNode body: (eachNode body asString)]
|
||||
]
|
||||
]
|
||||
|
||||
{ #category : #exporting }
|
||||
GrafoscopioNode >> hasAncestorHeaderWith: aSpecialWord [
|
||||
"Looks if the receptor node has an ancestor with a header with 'aSpecialWord' as the only or the first word"
|
||||
|
Loading…
Reference in New Issue
Block a user