From f4df40207f5ff873ac4f2e155373e7a10ee0ddca Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 30 Aug 2014 12:02:49 +0100 Subject: Support footnotes --- tests/mammoth_tests.py | 19 +++++++++++++++++++ tests/test-data/footnotes.docx | Bin 0 -> 15936 bytes 2 files changed, 19 insertions(+) create mode 100755 tests/test-data/footnotes.docx (limited to 'tests') 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'

Ouch' + + u'[1].' + + u'[2]

' + + u'
  1. A tachyon walks into a bar. ↑

  2. ' + + u'
  3. Fin. ↑

') + + 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): diff --git a/tests/test-data/footnotes.docx b/tests/test-data/footnotes.docx new file mode 100755 index 0000000..3228e74 Binary files /dev/null and b/tests/test-data/footnotes.docx differ -- cgit v1.2.3