def footnotes_of_document_are_read(self):
     notes = [documents.note("footnote", "4", [documents.paragraph([])])]
     
     body_xml = xml_element("w:body")
     document_xml = xml_element("w:document", {}, [body_xml])
     
     document = _read_and_get_document_xml_element(document_xml, notes=notes)
     footnote = document.notes.find_note("footnote", "4")
     assert_equal("4", footnote.note_id)
     assert isinstance(footnote.body[0], documents.Paragraph)
    def footnotes_of_document_are_read(self):
        notes = [documents.note("footnote", "4", [documents.paragraph([])])]

        body_xml = xml_element("w:body")
        document_xml = xml_element("w:document", {}, [body_xml])

        document = _read_and_get_document_xml_element(document_xml,
                                                      notes=notes)
        footnote = document.notes.find_note("footnote", "4")
        assert_equal("4", footnote.note_id)
        assert isinstance(footnote.body[0], documents.Paragraph)
示例#3
0
def footnotes_are_included_after_the_main_body():
    footnote_reference = documents.note_reference("footnote", "4")
    document = documents.document(
        [documents.paragraph([_run_with_text("Knock knock"), documents.run([footnote_reference])])],
        notes=documents.notes([documents.note("footnote", "4", [_paragraph_with_text("Who's there?")])]),
    )
    result = convert_document_element_to_html(document, id_prefix="doc-42")
    expected_html = (
        '<p>Knock knock<sup><a href="#doc-42-footnote-4" id="doc-42-footnote-ref-4">[1]</a></sup></p>'
        + '<ol><li id="doc-42-footnote-4"><p>Who\'s there? <a href="#doc-42-footnote-ref-4">↑</a></p></li></ol>'
    )
    assert_equal(expected_html, result.value)
def footnotes_are_included_after_the_main_body():
    footnote_reference = documents.note_reference("footnote", "4")
    document = documents.document(
        [documents.paragraph([
            _run_with_text("Knock knock"),
            documents.run([footnote_reference])
        ])],
        notes=documents.notes([
            documents.note("footnote", "4", [_paragraph_with_text("Who's there?")])
        ])
    )
    result = convert_document_element_to_html(
        document,
        id_prefix="doc-42"
    )
    expected_html = ('<p>Knock knock<sup><a href="#doc-42-footnote-4" id="doc-42-footnote-ref-4">[1]</a></sup></p>' +
                '<ol><li id="doc-42-footnote-4"><p>Who\'s there? <a href="#doc-42-footnote-ref-4">↑</a></p></li></ol>')
    assert_equal(expected_html, result.value)