On Sat, Jul 24, 2010 at 9:42 AM, Max Battcher <m...@worldmaker.net> wrote:
> On 07/23/2010 11:58 AM, Jean Daniel wrote:
>>
>> Hello
>>
>> When writing tutorials and articles, I find myself writing
>> repetitively the same boiler plate pattern. I want a link to a page
>> showing a colorized, highlighted, formatted version of an iteration of
>> the script in progress. Here is what I do:
>>
>> 1.  I write :doc:`script_1`
>>
>> 2. then write a three line text file called script_1.rst which
>> contains the following lines:
>>
>> Here is a naive implementation
>> =========================
>>
>> .. literalinclude:: script_1.py
>>
>> When there are tens iterations of the script, there are twenty files
>> (tens scripts, and ten almost empty rst files)
>>
>> Is there an nicer way to express this? I would like to write something
>> like :src:`script_1.py`...
>
> One solution is that in the Sphinx 1.0 betas there is a new extension called
> viewcode that automatically creates links from documentation about Python
> code to Pygments-highlighted source files:
>
> http://sphinx.pocoo.org/ext/viewcode.html
>

It is indeed a solution. If I understand well: to show a whole file, I
will need to use the directive automodule . It is a bit different than
what I thought but it could do the trick.

Thank you,

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to