diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-08-30 12:02:49 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-08-30 12:02:49 +0100 |
| commit | f4df40207f5ff873ac4f2e155373e7a10ee0ddca (patch) | |
| tree | a2923addccd51977727745026ea3a4f5969a18cd /tests/mammoth_tests.py | |
| parent | cc671a920c1ce5886fcc6629965000bfc469fea1 (diff) | |
Support footnotes
Diffstat (limited to 'tests/mammoth_tests.py')
| -rw-r--r-- | tests/mammoth_tests.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 7ef8049..f744711 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -1,3 +1,5 @@ +# coding=utf-8 + from nose.tools import istest, assert_equal from .testing import test_path @@ -52,6 +54,23 @@ def word_tables_are_converted_to_html_tables(): assert_equal([], result.messages) assert_equal(expected_html, result.value) + +@istest +def footnotes_are_appended_to_text(): + # TODO: don't duplicate footnotes with multiple references + expected_html = (u'<p>Ouch' + + u'<sup><a href="#footnote-42-1" id="footnote-ref-42-1">[1]</a></sup>.' + + u'<sup><a href="#footnote-42-2" id="footnote-ref-42-2">[2]</a></sup></p>' + + u'<ol><li id="footnote-42-1"><p> A tachyon walks into a bar. <a href="#footnote-ref-42-1">↑</a></p></li>' + + u'<li id="footnote-42-2"><p> Fin. <a href="#footnote-ref-42-2">↑</a></p></li></ol>') + + with open(test_path("footnotes.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, generate_uniquifier=lambda: 42) + # TODO: get rid of warnings + #~ assert_equal([], result.messages) + assert_equal(expected_html, result.value) + + @istest def transform_document_is_applied_to_document_before_conversion(): def transform_document(document): |
