#!C:/dev/python25/python.exe # coding: utf-8 """ Test a simple document containing citations, definition lists, and footnotes. >>> test_wordml(''' ... Just A Test ... ----------- ... ... :author: Alan G. Isaac ... :contact: aisaac@american.edu ... :date: |date| ... ... .. |date| date:: ... ... ... Term1 ... with a definition ... ... with another definition ... ... Term2 ... with a definition ... ... Here is a citation reference: [mycite2007]_. ... ... With a footnote. [#fntest]_ ... ... .. [#fntest] The note. ... ... .. [mycite2007] ... Citation text. ... ''') Just A Test Alan G. Isaac aisaac@american.edu %date% Term1 with a definition with another definition Term2 with a definition Here is a citation reference: [mycite2007] Citation text. [mycite2007] . With a footnote. The note. """ from docutils import core, io import sys def test_wordml( input_string ): overrides = { 'template' : '../template.xml' } parts = core.publish_string( input_string, writer_name='docutils_wordml', settings_overrides=overrides ) print parts def _test(): import doctest import datetime today = datetime.date.today().strftime("%Y-%m-%d") m = sys.modules.get('__main__') m.__doc__ = m.__doc__.replace( "%date%", today ); doctest.testmod() if __name__ == "__main__": _test()