restructred text substitutions available in all files from one include?

492 views
Skip to first unread message

Viktor Haag

unread,
May 15, 2012, 5:30:10 PM5/15/12
to sphin...@googlegroups.com
I'd like to use some of the common symbol entity substitutions afforded by restructured text in my Sphinx docs, using

.. include:: <isonnums.txt>

and so forth. Is there a way to include this file once for my whole project, so that I can use the |copy| and similar substitutions in all documents in my project? As it stands, it appears I have to .. include the file for every RST file in my project where I use such a substitution...

Thanks!

--
Viktor Haag

Skipper Seabold

unread,
May 15, 2012, 5:36:06 PM5/15/12
to sphin...@googlegroups.com

Kathy Tolbert

unread,
May 15, 2012, 6:48:19 PM5/15/12
to sphin...@googlegroups.com

I'd like to use some of the common symbol entity substitutions afforded by restructured text in my Sphinx docs, using

 

.. include:: <isonnums.txt>

 

and so forth. Is there a way to include this file once for my whole project, so that I can use the |copy| and similar substitutions in all documents in my project? As it stands, it appears I have to .. include the file for every RST file in my project where I use such a substitution...

 

 

Hi Victor,

 

I’m not sure if this is exactly what you have in mind…

 

We use a single substitutions file for 3 different sets of documentation. It lives a directory above each set of documentation project.

 

Documentation

    -- 00-Sandbox-directory

     -- Product-A-directory

    -- Product-B-directory

    -- Product-C-directory

     -- extensions-directory-for-all-products

     substitutions.rst

 

All files in each product directory contain the following line at the top of each document (line 1), followed by the chapter title:

 

.. include:: ../../substitutions.rst

 

==================

Chapter Title Here

==================

 

Kathy

 

 

Viktor Haag

unread,
May 17, 2012, 9:10:19 AM5/17/12
to sphin...@googlegroups.com
Cool! Thats' exactly it. Thanks. It boggled me that there wasn't some way to do this.

On Tuesday, 15 May 2012 17:36:06 UTC-4, jsseabold wrote:

http://sphinx.pocoo.org/config.html#confval-rst_epilog

Viktor Haag

unread,
May 17, 2012, 9:12:09 AM5/17/12
to sphin...@googlegroups.com


On Tuesday, 15 May 2012 18:48:19 UTC-4, Kathy Tolbert wrote:

All files in each product directory contain the following line at the top of each document (line 1), followed by the chapter title:


Hey Kathy,

Yes, what I'd like to avoid is exactly that "each file containing the following line at the top of each document". Luckily a more elegant solution exists: the "rst_epilog" and "rst_prolog" configuration values, as pointed out by jsseabold in this thread. Hope that helps _you_, too! 8)

--
v.

Kathy Tolbert

unread,
May 17, 2012, 11:54:13 AM5/17/12
to sphin...@googlegroups.com

Yes, what I'd like to avoid is exactly that "each file containing the following line at the top of each document". Luckily a more elegant solution exists: the "rst_epilog" and "rst_prolog" configuration values

 

 

Thanks. That is sweet! But, it doesn’t format the accent in the PDF output (missing a MikTex package?). Our substitutions require :raw-html: and :raw-latex: in order to display correctly in HTML and in the PDF. So, we’ll have to stick with our substitution line solution at the top of all docs. Great to know, though!

 

.. |sampletest| replace:: :raw-html:`<strong><em>SAMPLE</em> Test</strong>`:raw-latex:`{\textbf {\em SAMPLE} Test}`

 

Kathy

 

Viktor Haag

unread,
May 22, 2012, 10:12:01 AM5/22/12
to sphin...@googlegroups.com
On Thursday, 17 May 2012 11:54:13 UTC-4, Kathy Tolbert wrote:

Thanks. That is sweet! But, it doesn’t format the accent in the PDF output (missing a MikTex package?). Our substitutions require :raw-html: and :raw-latex: in order to display correctly in HTML and in the PDF. So, we’ll have to stick with our substitution line solution at the top of all docs. Great to know, though!


And great to know that it doesn't work in PDF output: I will add a comment to that effect in my conf. Right now I don't need anything but HTML output, but that might not always be the case...

--
Viktor
Reply all
Reply to author
Forward
0 new messages