diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index a95046a..fd83526 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -59,6 +59,16 @@ GrafoscopioNode class >> named: aString [ yourself ] +{ #category : #'as yet unclassified' } +GrafoscopioNode class >> specialWords [ + "I return a list of word that were used in the first versions of grafoscopio to mark node + headers to indicate special ways to handle them and their node contents. + Previous versions of first notebooks stored in grafoscopio using this convention should be + migrated to newer versions where tags are used for the same function with simpler code" + + ^ #('%config' '%abstract' '%invisible' '%idea' '%footnote' 'nuevoNodo' '%embed'). +] + { #category : #'add/remove nodes' } GrafoscopioNode >> addNode: aNode [ "Adds the given node to the receivers collection of children, and sets this object as the parent @@ -349,10 +359,9 @@ GrafoscopioNode >> level: anInteger [ GrafoscopioNode >> markdownContent [ "Extracts the markdown of a node using body as content, header as title and level as hierarchical level of the title. If special nodes types are present, converts them into proper markup to be embedded inside markdown" - | markdown configDict specialWords embedNodes temporalBody invisibleChildren | + | markdown configDict embedNodes temporalBody invisibleChildren | markdown := '' writeStream. - specialWords := #('%config' '%abstract' '%invisible' '%idea' '%footnote' 'nuevoNodo' '%embed'). - (specialWords includes: self header) not & (specialWords includes: ((self header findTokens: $ ) at: 1)) not & (self tags = 'código') not + (self class specialWords includes: self header) not & (self class specialWords includes: ((self header findTokens: $ ) at: 1)) not & (self tags = 'código') not ifTrue: [ self level timesRepeat: [ markdown nextPutAll: '#' ]. markdown nextPutAll: ' '. @@ -398,6 +407,11 @@ GrafoscopioNode >> markdownContent [ ifTrue: [ invisibleChildren := self children. invisibleChildren ifNotNil: [ ] ]. + (self tags = 'código') + ifTrue: [ + markdown nextPutAll: ('\begin{minted}{smalltalk}'); lf. + markdown nextPutAll: (self body contents withInternetLineEndings); lf. + markdown nextPutAll: '\end{minted}';lf]. ^markdown contents ]