Example #1
0
paragraph.insert_variable(
    odf_create_time_variable(time(19, 30), time_adjust=timedelta(hours=1)),
    u"hour: ")

# 11- Chapter
# -----------

heading = odf_create_heading(1, text=u'Chapter')
body.append(heading)

text = u'The current chapter is: '

paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph.insert_variable(
    odf_create_chapter_variable(display='number-and-name'), u"is: ")

# 11- Filename
# ------------

heading = odf_create_heading(1, text=u'Filename')
body.append(heading)

text = u'The current file name is: '

paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph._insert_between(odf_create_filename_variable(), u"The", u"is: ")

# Save
# ----
Example #2
0
body.append(paragraph)
paragraph.insert_variable(odf_create_time_variable(time(19, 30),
    time_adjust=timedelta(hours=1)), u"hour: ")


# 9- Chapter
# -----------

heading = odf_create_heading(1, text=u'Chapter')
body.append(heading)

text = u'The current chapter is: '

paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph.insert_variable(odf_create_chapter_variable(display='number-and-name'),
        u"is: ")


# 10- Filename
# ------------

heading = odf_create_heading(1, text=u'Filename')
body.append(heading)

text = u'The current file name is: '

paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph._insert_between(odf_create_filename_variable(), u"The", u"is: ")
 def test_create_chapter_complex(self):
     chapter = odf_create_chapter_variable(display='number-and-name',
                                           outline_level=1)
     expected = ('<text:chapter text:display="number-and-name" '
                   'text:outline-level="1"/>')
     self.assertEqual(chapter.serialize(), expected)
 def test_create_chapter(self):
     chapter = odf_create_chapter_variable()
     expected = '<text:chapter text:display="name"/>'
     self.assertEqual(chapter.serialize(), expected)
Example #5
0
 def test_create_chapter_complex(self):
     chapter = odf_create_chapter_variable(display='number-and-name',
                                           outline_level=1)
     expected = ('<text:chapter text:display="number-and-name" '
                   'text:outline-level="1"/>')
     self.assertEqual(chapter.serialize(), expected)
Example #6
0
 def test_create_chapter(self):
     chapter = odf_create_chapter_variable()
     expected = '<text:chapter text:display="name"/>'
     self.assertEqual(chapter.serialize(), expected)