I have done this with a jinja template with data sourced from a database and it works well. I basically just generate .rst files by passing in the data to the jinja template and rendering to file - the template outputs section different headings, admonitions etc. based upon the data passed. The generation of 1600+ .rst files (I put the files into various folders based upon context and then generate index.rst for each folder so that I get a TOC that is relevant for each folder) is very quick - 1-2 mins on my machine. Running *make html *takes much longer as building the indexes etc. is relatively slow.
So I would say you are on the money with your approach. On Friday, 5 August 2016 16:52:50 UTC+1, Markus wrote: > > Hello group, > > I need to create documentation containing a dynamic and large number of > sections, where the structure of each section basically is the same. It > contains some descriptive text and one or more tables. > > Both the data for the sections and the data for the tables basically comes > from a big JSON file. > > Now, if I understand things correctly, I need to dynamically create one or > more reST files which are then processed into static HTML pages. > > Is there a way I can use the Jinja template engine to generate those reST > files from a template and the JSON file? As far as I know Jinja should be > able to generate the reST files from a template just fine. Am I right? > > What I have no idea is how to integrate the generation of the reST files > into the normal Sphinx workflow, meaning that when I type e.g. "make html" > Sphinx first invokes Jinja to generate the reST sources and then processes > the generated sources along with other static reST documents into the final > HTML format. > > Do I need to write an extension for this? Is there any existing extension > I can use? Am I totally off the track with my approach? > > Thanks in advance for any advice, > Markus > -- 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 https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
