예제 #1
0
 def test_create_note1(self):
     # With an odf_element
     note_body = odf_create_paragraph(u'a footnote', style='Standard')
     note = odf_create_note(note_id='note1', citation=u'1', body=note_body)
     expected = self.expected.replace(
         '<text:p>', '<text:p text:style-name="Standard">')
     self.assertEqual(note.serialize(), expected)
예제 #2
0
 def test_create_note1(self):
     # With an odf_element
     note_body = odf_create_paragraph(u'a footnote', style='Standard')
     note = odf_create_note(note_id='note1', citation=u'1',
                            body=note_body)
     expected = self.expected.replace('<text:p>',
                                      '<text:p text:style-name="Standard">')
     self.assertEqual(note.serialize(), expected)
예제 #3
0
def convert_footnote_reference(node, context):
    refid = node.get("refid")
    citation = node.astext()

    footnote = odf_create_note(note_id=refid, citation=citation)
    context["top"].append_element(footnote)

    context["footnotes"][refid] = footnote
예제 #4
0
 def test_insert_note(self):
     note = odf_create_note(note_id='note1', citation=u"1",
                            body=u"élément pertubateur")
     paragraph = odf_create_paragraph(u"Un paragraphe")
     paragraph.insert_note(note, after=u"para")
     expected = ('<text:p>Un para'
                   '<text:note text:note-class="footnote" '
                     'text:id="note1">'
                     '<text:note-citation>1</text:note-citation>'
                     '<text:note-body>'
                       '<text:p>&#233;l&#233;ment pertubateur</text:p>'
                     '</text:note-body>'
                   '</text:note>'
                 'graphe</text:p>')
     self.assertEqual(paragraph.serialize(), expected)
예제 #5
0
 def test_insert_note(self):
     note = odf_create_note(note_id='note1', citation=u"1",
                            body=u"élément pertubateur")
     paragraph = odf_create_paragraph(u"Un paragraphe")
     paragraph.insert_note(note, after=u"para")
     expected = ('<text:p>Un para'
                   '<text:note text:note-class="footnote" '
                     'text:id="note1">'
                     '<text:note-citation>1</text:note-citation>'
                     '<text:note-body>'
                       '<text:p>&#233;l&#233;ment pertubateur</text:p>'
                     '</text:note-body>'
                   '</text:note>'
                 'graphe</text:p>')
     self.assertEqual(paragraph.serialize(), expected)
예제 #6
0
 def test_insert_note_after_span(self):
     note = odf_create_note(note_id='note1', citation=u"1",
                            body=u"élément pertubateur")
     data = "<text:p>Un <text:span>para</text:span>graphe.</text:p>"
     paragraph = odf_create_element(data)
     paragraph.insert_note(note, after=u"graphe")
     expected = ('<text:p>Un <text:span>para</text:span>graphe'
                   '<text:note text:note-class="footnote" '
                     'text:id="note1">'
                     '<text:note-citation>1</text:note-citation>'
                     '<text:note-body>'
                       '<text:p>&#233;l&#233;ment pertubateur</text:p>'
                     '</text:note-body>'
                   '</text:note>'
                 '.</text:p>')
     self.assertEqual(paragraph.serialize(), expected)
예제 #7
0
 def test_insert_note_after_span(self):
     note = odf_create_note(note_id='note1', citation=u"1",
                            body=u"élément pertubateur")
     data = "<text:p>Un <text:span>para</text:span>graphe.</text:p>"
     paragraph = odf_create_element(data)
     paragraph.insert_note(note, after=u"graphe")
     expected = ('<text:p>Un <text:span>para</text:span>graphe'
                   '<text:note text:note-class="footnote" '
                     'text:id="note1">'
                     '<text:note-citation>1</text:note-citation>'
                     '<text:note-body>'
                       '<text:p>&#233;l&#233;ment pertubateur</text:p>'
                     '</text:note-body>'
                   '</text:note>'
                 '.</text:p>')
     self.assertEqual(paragraph.serialize(), expected)
예제 #8
0
 def test_create_note2(self):
     # With an unicode object
     note = odf_create_note(note_id='note1', citation=u'1',
                            body=u'a footnote')
     self.assertEqual(note.serialize(), self.expected)
예제 #9
0
 def test_create_note2(self):
     # With an unicode object
     note = odf_create_note(note_id='note1', citation=u'1',
                            body=u'a footnote')
     self.assertEqual(note.serialize(), self.expected)
예제 #10
0
# insert item by relative position
the = my_list.get_item(content=u'thé')
my_list.insert_item(u'Chicorée', before=the)
my_list.insert_item(u'Chicorée', after=the)

body.append(my_list)

#
# Footnote with odf_create_note of class "footnote" and insert_note
#
body.append(odf_create_heading(1, u"Footnotes"))
paragraph = odf_create_paragraph(u'A paragraph with a footnote '
                                      u'about references in it.')
note = odf_create_note(note_id='note1', citation=u"1",
                       body=u'Author, A. (2007). "How to cite references", '
                            u'New York: McGraw-Hill.')
paragraph.insert_note(note, after=u"graph")
body.append(paragraph)

#
# Annotations
#
body.append(odf_create_heading(1, u"Annotations"))
paragraph = odf_create_paragraph(u"A paragraph with an annotation "
                                 u"in the middle.")
annotation = odf_create_annotation(u"It's so easy!", creator=u"Luis")
paragraph.insert_annotation(annotation, after=u"annotation")
body.append(paragraph)

#
예제 #11
0
 def test_create_note2(self):
     # With an unicode object
     note = odf_create_note(note_id="note1", citation=u"1", body=u"a footnote")
     self.assertEqual(note.serialize(), self.expected)
예제 #12
0
 def test_create_note1(self):
     # With an odf_element
     note_body = odf_create_paragraph(u"a footnote", style="Standard")
     note = odf_create_note(note_id="note1", citation=u"1", body=note_body)
     expected = self.expected.replace("<text:p>", '<text:p text:style-name="Standard">')
     self.assertEqual(note.serialize(), expected)
예제 #13
0
# insert item by relative position
the = my_list.get_item(content=u'thé')
my_list.insert_item(u'Chicorée', before=the)
my_list.insert_item(u'Chicorée', after=the)

body.append(my_list)

#
# Footnote with odf_create_note of class "footnote" and insert_note
#
body.append(odf_create_heading(1, u"Footnotes"))
paragraph = odf_create_paragraph(u'A paragraph with a footnote '
                                 u'about references in it.')
note = odf_create_note(note_id='note1',
                       citation=u"1",
                       body=u'Author, A. (2007). "How to cite references", '
                       u'New York: McGraw-Hill.')
paragraph.insert_note(note, after=u"graph")
body.append(paragraph)

#
# Annotations
#
body.append(odf_create_heading(1, u"Annotations"))
paragraph = odf_create_paragraph(u"A paragraph with an annotation "
                                 u"in the middle.")
annotation = odf_create_annotation(u"It's so easy!", creator=u"Luis")
paragraph.insert_annotation(annotation, after=u"annotation")
body.append(paragraph)

#