From bde5e0a9383aae44adc6b49c126026beab736f2d Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 14 Jul 2017 10:53:24 +0000 Subject: [PATCH] Suport for empty items. --- .../Grafoscopio/GrafoscopioNode.class.st | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index ee5507b..b18ea00 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -92,7 +92,7 @@ GrafoscopioNode class >> specialWords [ 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'). + ^ #('%config' '%abstract' '%invisible' '%idea' '%footnote' 'nuevoNodo' '%embed' '%item'). ] { #category : #'add/remove nodes' } @@ -534,6 +534,28 @@ GrafoscopioNode >> isEmpty [ body ifNil: [ ^ true ] ifNotNil: [ ^ false ] ] +{ #category : #exporting } +GrafoscopioNode >> itemAsMarkdownInto: aStream [ + "I export a node with %item in its header as valid Pandoc's markdown + 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 markdownContent..." + + | lines | + lines := self body contents asString withInternetLineEndings lines. + lines ifEmpty: [ ^ self ]. + aStream + nextPutAll: ' - '; + nextPutAll: lines first; + lf. + lines + allButFirstDo: [ :line | + aStream + nextPutAll: ' '; + nextPutAll: line; + lf ]. + aStream nextPutAll: String lf +] + { #category : #accessing } GrafoscopioNode >> key [ "Returns a unique key identifying the receiver in the help system"