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

« back to all changes in this revision

Viewing changes to www/apps/tutorial/__init__.py

  • Committer: stevenbird
  • Date: 2008-02-20 11:50:03 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:523
Adding ReStructured Text preprocessing of exercise descriptions,
so that the markup for exercises is the same as for the tutorials.

www/apps/tutorial/rst.py
* cut down version of NLTK rst.py, which extends docutils
  with colourised python codeblocks
* modified to work with strings rather than files

www/apps/tutorial/__init__.py
* call rst() main function on exercise description once
  it is extracted from the source XML file

www/apps/tutorialservice/test/TestFramework.py
* clean up docstring

www/apps/tutorialservice/test/parse_exercise.py
* remove backwards compatibility for desc attribute
  (now authors must provide both pass and fail strings)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
import conf
41
41
import plugins.console
42
42
 
 
43
from rst import rst
 
44
 
43
45
THIS_APP = "tutorial"
44
46
 
45
47
# Regex for valid identifiers (subject/worksheet names)
304
306
    for elem in exercisedom.childNodes:
305
307
        if elem.nodeType == elem.ELEMENT_NODE:
306
308
            if elem.tagName == "desc":
307
 
                exercisedesc = innerXML(elem).strip()
 
309
                exercisedesc = rst(innerXML(elem).strip())
308
310
            if elem.tagName == "partial":
309
311
                exercisepartial= getTextData(elem) + '\n'
310
312