Hi!

I need to write following scheme many times in my text (variable parts are 
shown with underline):

.. _exercise-*union_of_two_lists*:

.. include:: exercises/*union_of_two_lists*.py
    :start-after: """
    :end-before: """ 

I'd like to replace this with

.. exercise:: *union_of_two_lists*

What's the best/simplest approach for achieving this?
Can I just replace my directive with shown two directives during read phase?
Are "include"-s included during read phase or later?
Can you recommend an example extension, which does something similar?


----------------
The background of my problem: I'm trying to make my programming textbook 
more interactive by associating programming exercises with automatic 
feedback scripts. I'd like to keep exercise text and analyzer code together 
in one Python file, something like that:

"""
Exercise text (in reST format)
"""
# ...
# Python code for testing/analyzing the solution
# ...

In the main text of the book, I need to include the exercise text from the 
beginning of the file and also generate a marker indicating the exercise id 
(*union_of_two_lists* in my example) in the resulting HTML, so that 
JavaScript can create a submission link/form in the right place.

best regards,
Aivar


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to