diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-08-29 11:37:27 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-08-29 11:37:27 +0100 |
| commit | 955a29e828d40123ec64a479b1c4c5164db3c681 (patch) | |
| tree | a83a65b91bd02c753789f5b57fd68bfbc446c5aa /src/test/java | |
| parent | 28c8b89afea499191b13849140354b21819937f4 (diff) | |
Wire up comment conversion code
Diffstat (limited to 'src/test/java')
3 files changed, 16 insertions, 2 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index 455fa0c..fff4cb3 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -155,6 +155,19 @@ public class MammothTests { } @Test + public void whenStyleMappingIsDefinedForCommentReferencesThenCommentsAreIncluded() throws IOException { + assertThat( + convertToHtml("comments.docx", mammoth -> mammoth.idPrefix("doc-42-").addStyleMap("comment-reference => sup")), + isSuccess( + "<p>Ouch" + + "<sup><a href=\"#doc-42-comment-0\" id=\"doc-42-comment-ref-0\">[MW1]</a></sup>." + + "<sup><a href=\"#doc-42-comment-2\" id=\"doc-42-comment-ref-2\">[MW2]</a></sup></p>" + + "<dl><dt id=\"doc-42-comment-0\">Comment [MW1]</dt><dd><p>A tachyon walks into a bar. <a href=\"#doc-42-comment-ref-0\">↑</a></p></dd>" + + "<dt id=\"doc-42-comment-2\">Comment [MW2]</dt><dd><p>Fin. <a href=\"#doc-42-comment-ref-2\">↑</a></p></dd></dl>" + )); + } + + @Test public void relationshipsAreReadForEachFileContainingBodyXml() throws IOException { assertThat( convertToHtml("footnote-hyperlink.docx", mammoth -> mammoth.idPrefix("doc-42-")), diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java index 3a0da26..f59bf58 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java @@ -704,6 +704,7 @@ public class BodyXmlTests { assertIsIgnored("w:del"); assertIsIgnored("w:footnoteRef"); assertIsIgnored("w:endnoteRef"); + assertIsIgnored("w:annotationRef"); assertIsIgnored("w:pPr"); assertIsIgnored("w:rPr"); assertIsIgnored("w:tblPr"); diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java index 9697c6d..19f1a95 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java @@ -31,7 +31,7 @@ public class DocumentXmlTests { element("w:t", list( XmlNodes.text("Hello!"))))))))))); - DocumentXmlReader reader = new DocumentXmlReader(bodyReader(), Notes.EMPTY); + DocumentXmlReader reader = new DocumentXmlReader(bodyReader(), Notes.EMPTY, list()); assertThat( reader.readElement(documentElement), @@ -45,7 +45,7 @@ public class DocumentXmlTests { public void notesOfDocumentAreIncludedInDocument() { Note note = new Note(NoteType.FOOTNOTE, "4", list(paragraphWithText("Hello"))); Notes notes = new Notes(list(note)); - DocumentXmlReader reader = new DocumentXmlReader(bodyReader(), notes); + DocumentXmlReader reader = new DocumentXmlReader(bodyReader(), notes, list()); XmlElement documentElement = element("w:document", list(element("w:body"))); InternalResult<Document> document = reader.readElement(documentElement); |
