Re: [sphinx-users] Re: Advice needed on automatically generated documentation

2016-08-11 Thread Luc Saffre
If you do "from atelier.rstgen import table" and then add 'table' to
your jinja context, then you should be able to do it as follows::

  .. jinja:: messages

  {% table(['Message Code', 'Message name'], stc.items()) %}

http://atelier.lino-framework.org/api/atelier.rstgen.html
(I am the author)

Luc



On 11/08/16 09:54, Markus wrote:
> Thanks to all who replied. I'm now using the sphinx-jinja extension
> and it works pretty well. I have no trouble using JSON files as input.
>
> At first I had a little trouble getting the whitespace generated
> correctly, but this was fixed by correctly using -%} and {%- when
> generating tables, and manually inserting whitespace like so:
>
> .. jinja:: messages
>
>  
>Message Code  Message Name
>  
>{% for k, v in stc -%}
>{{"%-13s  %s\n" % (k, v)}}
>{%- endfor %}
>  
>
> 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 sphinx-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to sphinx-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.


-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.


[sphinx-users] Re: Advice needed on automatically generated documentation

2016-08-07 Thread Neil Kelly
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 sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.