~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/worksheet/rst.py

  • Committer: Nick Chadwick
  • Date: 2009-03-03 01:48:48 UTC
  • mto: (1099.1.227 exercise-ui)
  • mto: This revision was merged to the branch mainline in revision 1162.
  • Revision ID: chadnickbok@gmail.com-20090303014848-dyurvmtmbneohd7f
Modified the setup script to include '.txt' files.

This allows the automatic inclusion of definitions.txt from the rst
code, as it is needed by all worksheets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
      'pysrc-prompt', 'pysrc-keyword', 'pysrc-string', 'pysrc-comment',
19
19
      and 'pysrc-output'.
20
20
"""
21
 
import re, os.path, textwrap, sys, pickle
 
21
import re, os.path, textwrap, sys, pickle, inspect
22
22
from optparse import OptionParser
23
23
 
24
24
import docutils.core, docutils.nodes, docutils.io
1690
1690
def rst(input):
1691
1691
    try:
1692
1692
        CustomizedHTMLWriter.settings_defaults.update()
 
1693
        header = '.. include:: ' + os.path.join(
 
1694
            os.path.dirname(inspect.getfile(rst)), 'definitions.txt') + '\n' 
 
1695
        input = header + input
1693
1696
        output = docutils.core.publish_string(input,
1694
1697
            writer=CustomizedHTMLWriter(), reader=CustomizedReader())
1695
1698
        match = _OUTPUT_RE.search(output)