From: Peter M. <pe...@mo...> - 2010-02-22 12:56:18
|
Could you use a templating system like Cheetah or Django templates? Turn your ReST to HTML with the "variables" still there and then put the result through the templating system. That gives you a lot of flexibility. -- Peter David Goodger wrote: > On Sun, Feb 21, 2010 at 16:18, Yuri D'Elia <wa...@us...> wrote: > >> Hi everyone. I'm using the publish_parts API to generate some HTML files from >> ReST sources. I want to introduce some 'variables' into the document, and >> "substitution references" seemed the perfect match. >> >> How can I define a substitution reference programmatically so that I can use its >> value though-out the document by using the |ref| syntax? >> > > The easiest way would be to tack on the text of the substitution > definitions to the input reST sources. Either do it manually with an > "include" directive, or programmatically by concatenating text. > > I'm sure it could also be done directly, but there's no simple API for > it that would take care of all the bookkeeping. > > |