Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 26.02.2010 17:22, schrieb Fernando Perez: Hi, On Sun, Feb 21, 2010 at 9:46 AM, Georg Brandl ge...@python.org wrote: @Günter: section titles can be matched in nested parsing if you set the match_titles argument to true. I am very happy that this works, other- wise autodoc would have lots of problems with titles in docstrings. Where is this argument to be set, conf.py as a global, or elsewhere? I'd like to use this to generate more cleanly structured docs (right now I'm pushing solutions to be nested even in places where it would make more sense for them to match the surrounding title level). It must be set internally, as an argument of the nested_parse() method that directives like only use for parsing their content. You can't change that argument, but it is already set to True from 0.6.3 on. Georg -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkuJnPUACgkQN9GcIYhpnLDqSgCfaq6tZyLLbyYDBhOrXri/bf8O ukgAnRHNruL/94/zIbCY6fQYgIMdLzkP =+Mib -END PGP SIGNATURE- -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
Hi, On Sun, Feb 21, 2010 at 9:46 AM, Georg Brandl ge...@python.org wrote: @Günter: section titles can be matched in nested parsing if you set the match_titles argument to true. I am very happy that this works, other- wise autodoc would have lots of problems with titles in docstrings. Where is this argument to be set, conf.py as a global, or elsewhere? I'd like to use this to generate more cleanly structured docs (right now I'm pushing solutions to be nested even in places where it would make more sense for them to match the surrounding title level). Thanks! f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
Hi Kevin, On Fri, Feb 5, 2010 at 11:58 AM, Kevin Dunn kgd...@gmail.com wrote: That could be it. I use the 1.00 version from hg because of a bug in prior versions with and symbols that appear in source code with LaTeX output. Did you actually build these and got the expected output? I updated sphinx to hg trunk, and even though now your approach doesn't give me any errors, it simply won't produce any output for that section. For now I've settled instead on using: .. only:: instructor .. toctree:: bessel_sol where the _sol file can then contain normal markup. It's a bit silly as those _sol files end up sometimes being two-liners, so it would be nice to have a fully clean solution to this. In any case, many thanks for your help. By the way, thanks for IPython. My pleasure! Cheers, f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
On Tue, Feb 9, 2010 at 10:52 PM, Fernando Perez fperez@gmail.com wrote: Did you actually build these and got the expected output? I updated sphinx to hg trunk, and even though now your approach doesn't give me any errors, it simply won't produce any output for that section. Scratch that! Your solution does work, thanks! As I went back to update sphinx and try again, I forgot about the small limitation of only being allowed to start a new section level, not continuing with another section header at the same level as the text before. So in summary, with that minor limitation, your approach does work, sorry for the noise. If one truly needs the conditional text to include more sections as the same level as the text before, I guess the toctree call is the only one I can think of for now, but it does the job. Regards, f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
On Thu, Feb 4, 2010 at 7:18 PM, Kevin Dunn kgd...@gmail.com wrote: I use the same idea for my class notes - the students get one version and the projector notes get a different version. This is what I ended up doing it (there may be a better way!): Thanks a lot, this will do for now, though I'll also reply to Guenter's comments, which are very relevant. As he points out, unfortunately nested sections don't seem to work (if you were able to make them work as you mention, I'd love to see how you did it, because I couldn't). But I ended up using this: .. only:: instructor .. admonition:: Solution The solution is... .. literalinclude:: examples/wordfreqs.py This at least gives me a little box for the description of the solution (and boldface in pdf), and I can also include code fragments. It will do for now, and it's very easy to use. But I'd really like to have a full solution to this, so we can also include section markup, etc... I need to get back to writing lecture notes so I'll use this for now, but I'd love to hear more ideas if anyone has any. Thank again, this does get me going though! Cheers, f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
On Fri, Feb 5, 2010 at 11:26 AM, Kevin Dunn kgd...@gmail.com wrote: Below is how I how did it. But on re-reading your question, I realize this is probably not exactly what you want - you can create a nested subsection, but you can't go back to a higher level section. Your approach would be just fine for me, that's quite allright. I can put what I want in a subsection. However, oddly enough it doesn't work for me (I put your text verbatim in a file): reST markup error: /home/fperez/teach/py4science/book/wordfreqs.rst:14: (SEVERE/4) Unexpected section title. Also consider this --- make: *** [latex] Error 1 Note that I had to revert to sphinx 0.6.2, because sphinx from hg mangled my website when I rebuilt it (the sidebar disappeared) and I'm under too much time pressure to debug the hg version right now. If you think this is the problem, then I'll stick to my prior approach until I can debug what is wrong in the hg version of sphinx regarding my disappearing sidebar. Thanks again, f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
On Fri, Feb 5, 2010 at 11:49, Fernando Perez fperez@gmail.com wrote: On Fri, Feb 5, 2010 at 11:26 AM, Kevin Dunn kgd...@gmail.com wrote: Below is how I how did it. But on re-reading your question, I realize this is probably not exactly what you want - you can create a nested subsection, but you can't go back to a higher level section. Your approach would be just fine for me, that's quite allright. I can put what I want in a subsection. However, oddly enough it doesn't work for me (I put your text verbatim in a file): reST markup error: /home/fperez/teach/py4science/book/wordfreqs.rst:14: (SEVERE/4) Unexpected section title. Also consider this --- make: *** [latex] Error 1 Note that I had to revert to sphinx 0.6.2, because sphinx from hg mangled my website when I rebuilt it (the sidebar disappeared) and I'm under too much time pressure to debug the hg version right now. If you think this is the problem, then I'll stick to my prior approach until I can debug what is wrong in the hg version of sphinx regarding my disappearing sidebar. That could be it. I use the 1.00 version from hg because of a bug in prior versions with and symbols that appear in source code with LaTeX output. By the way, thanks for IPython. Kevin Thanks again, f -- 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.
[sphinx-dev] Non-trivial conditional include with ifconfig?
Hi all, I need to include some material (exercise solutions) for a doc build only in certain cases, but all my attempts so far are failing. This: .. ifconfig:: include_solutions==True Something trivial Works, and I see 'something trivial' in the pdf (I set ifconfig as per http://sphinx.pocoo.org/ext/ifconfig.html, using sphinx from hg here). But I actually need a section title, and calls to source code inclusion and math directives in there. I tried things like: .. ifconfig:: include_solutions==True Solution Solution .. literalinclude:: examples/wordfreqs.py and a ton of variations, but so far nothing works. Any hints on better use of ifconfig or perhaps an alternate solution to this problem would be greatly appreciated. Cheers, f -- 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.
Re: [sphinx-dev] Non-trivial conditional include with ifconfig?
Hi Fernando, I use the same idea for my class notes - the students get one version and the projector notes get a different version. This is what I ended up doing it (there may be a better way!): In your ReST code you something like: .. only:: student - The answer for x = - The answer for y = .. only:: instructor - The answer for x = :math:`238.8 - 3 \cdot \dfrac{9.28}{(0.94)(\sqrt{5})} = 225.6` - The answer for y = :math:`238.8 + 3 \cdot \dfrac{9.28}{(0.94)(\sqrt{5})} = 252.0` A quick test on my end (not shown in the above code) shows that it will handle the section idea that you require. Then in my conf.py file I have these lines: # The setting for student or instructor display. Uncomment the relevant line: #tags.add('instructor') tags.add('student') Hope that helps, Kevin On Thu, Feb 4, 2010 at 19:01, Fernando Perez fperez@gmail.com wrote: Hi all, I need to include some material (exercise solutions) for a doc build only in certain cases, but all my attempts so far are failing. This: .. ifconfig:: include_solutions==True Something trivial Works, and I see 'something trivial' in the pdf (I set ifconfig as per http://sphinx.pocoo.org/ext/ifconfig.html, using sphinx from hg here). But I actually need a section title, and calls to source code inclusion and math directives in there. I tried things like: .. ifconfig:: include_solutions==True Solution Solution .. literalinclude:: examples/wordfreqs.py and a ton of variations, but so far nothing works. Any hints on better use of ifconfig or perhaps an alternate solution to this problem would be greatly appreciated. Cheers, f -- 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.