a pandoc filter for creating annotations

Viewed 104

I'm trying to convert some html documents containing annotated text into an odt (or docx) with the annotations as comments. It seems like something for a pandoc filter.

The input contains the text, an identifier and link...

<span class="comment c-MIGWMM5CsW0d4l4y">Some annotated text
  <sup><a href="#c-MIGWMM5CsW0d4l4y">*</a></sup>
</span>

and elsewhere in the same file the comment text and identifier...

<p role="comment" class="comment" id="c-MIGWMM5CsW0d4l4y">a comment</p>

an annotation/comment in an ODT file looks something like this...

<text:p text:style-name="P1">
  <office:annotation office:name="__Annotation__0_1417392441" loext:resolved="false">
    <dc:creator>GCU Arbitrary</dc:creator>
    <dc:date>2022-02-10T17:53:16.400752734</dc:date>
    <text:p text:style-name="P2">
      <text:span text:style-name="T1">a comment</text:span>
    </text:p>
  </office:annotation>Some annotated text<office:annotation-end office:name="__Annotation__0_1417392441"/>
</text:p>

Where to begin?

EDIT: The pandoc writer for ODT doesn't appear to write annotations to .odt files and they don't seem to be represented in the AST (e.g. pandoc --from odt --to native comment.odt ignores comments)

In this case I guess there would need to be a way to represent the annotations in the AST and possibly reader/writer extensions rather than a simple filter?

Another approach could be an XML or XSLT filter for soffice

0 Answers
Related