We use the literalinclude method for the examples in the Manual and Tutorials for the SimPy free simulation package built on Python. We test the examples separately.
==== Tony Vignaux On Sat, Jan 7, 2012 at 5:57 PM, Roger Binns <rog...@rogerbinns.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/01/12 14:53, Bruce Eckel wrote: > > I always have the first line of a code listing example as a comment > > that gives the name of the file in the comment, but if you had a tag > > that required the file name then you could use that to extract the code > > AND to create a caption for the example giving the file name. > > It would seem that you could use the literalinclude directive. > > http://sphinx.pocoo.org/markup/code.html#directive-literalinclude > > That way you can keep your examples as separate code files (easy to test > and run), but using literalinclude still bring them into the doc with line > numbers for discussion. Note that you can even bring in just subsets of > the file (for Python anyway). > > Roger > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > > iEYEARECAAYFAk8H0NQACgkQmOOfHg372QRfmgCfU5sa3hQJEkxlpfmJ3n0PrIUg > EPcAnixeThYqE3AmKxd/PKMgiEHzmOBc > =GGfK > -----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-dev@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. > > -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@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.