The Pillar documentation [1] says...
"An annotated paragraph starts a line with @@ followed by either todo or note. For example,
       @@note this is a note annotation.
   generates
        Note: this is a note annotation.
   And,
       @@todo this is a todo annotation
   generates a todo annotation that is not visible in the output."

However this does not work when rendering to LaTex.
   * The notes do not start with "Note:"
   * The todos are visible

This seemed to be handled by...
   PRMarkdownWriter>>visitAnnotatedParagraph: anAnnotatedParagraph
"Pier seams to lack consistensy here ..." needsABreak ifTrue: [ canvas addInvisibleSeparator ].

       anAnnotatedParagraph annotation asLowercase = 'todo'
           ifTrue: [ ^ self visitCommentedLine: anAnnotatedParagraph ].

self nest: [ :brush | brush
               name: ''
               with: [ :nestedStream |
                   self writeRawDuring: [
                       nestedStream << 'Note: '.
nestedStream << anAnnotatedParagraph text trimBoth ] ] ]. needsABreak := true.

but that there is no equivalent PRLaTexWriter>>visitAnnotatedParagraph:
and the following is used by default...
   PRVisitor>>visitAnnotatedParagraph: aDocument
       self visitParagraph: aDocument


In seeking to fix this for LaTex I found...
* /needsABreak/ is an ivar of PRMarkdown and I guess not applicable to LaTex
* #nest: and the /nest/ ivar it references belong to PRMarkdown, and I'm not sure of their purpose.

So I cut those out, which left the following...
   PRLaTexWriter>>visitAnnotatedParagraph
       anAnnotatedParagraph annotation asLowercase = 'todo'
           ifTrue: [ ^ self visitCommentedLine: anAnnotatedParagraph ].

       self writeRawDuring: [
           nestedStream << 'Note: '.
           nestedStream << anAnnotatedParagraph text trimBoth ].

...which works well enough for the usage I see so far in PharoLaserGameTutorial. [2]

Now is there any important function missing, or is there a better way to do this?
I also want add an annotation type, which I'll describe in a following post.

cheers -ben

[1] https://github.com/pillar-markup/pillar-documentation
[2] https://github.com/bencoman/PharoLaserGameTutorial

Reply via email to