playground: rst: more demos

This commit is contained in:
Jérôme Carretero 2013-08-25 19:57:29 -04:00
parent 459f04cbee
commit 6d5cbfc3e6
3 changed files with 71 additions and 3 deletions

View File

@ -4,12 +4,18 @@ Example 1
:purpose: demonstrate basic rst processing
Static SVG Picture
##################
.. figure:: test.svg
:align: center
:width: 50%
This is a static svg file
Generated PNG Picture
#####################
.. figure:: test.png
:align: center
:width: 50%
@ -20,19 +26,44 @@ Example 1
As of 2013-08-25, rst2pdf and docutils do not have
some way of specifying include paths, in which includes
are searched.
So the figure is broken.
We could generate the figure in the source directory,
but I prefer not having a figure at all for the sake
of cleanleness.
A docutils patch is available here though:
http://zougloub.eu/git/overlay-zougloub/plain/dev-python/docutils/files/docutils-0.11-search-path.patch
Generated rst Content
#####################
.. include:: generated.rst
Generated CSV Content
#####################
As of 2013-08-25, waf doesn't scan the csv-table directive
including an external file. You'll have to specify
the dependency manually, use build groups, or count on your luck.
.. csv-table::
:file: generated.csv
Generated Content using raw Directive
#####################################
The following line will be empty if not using the HTML
output.
.. raw:: html
:file: generated.html
Did you see something?
As of 2013-08-25, waf doesn't scan the raw directive
including an external file. You'll have to specify
the dependency manually, use build groups, or count on your luck.

View File

@ -4,10 +4,42 @@ Example 2
:purpose: demonstrate rst processing through rst2latex
Generated PDF Picture
#####################
.. figure:: test.pdf
:align: center
:width: 50%
This is a generated pdf file
This figure shows a pdf file that was auto-generated
(test.pdf).
Generated PNG Picture
#####################
.. figure:: test.png
:align: center
:width: 50%
This figure shows a pdf file that was auto-generated
(test.png).
Generated rst Content
#####################
.. include:: generated.rst
Generated CSV Content
#####################
.. csv-table::
:file: generated.csv
Generated LaTeX Content (raw Directive)
#######################################
.. raw:: latex
:file: generated.tex

View File

@ -57,6 +57,11 @@ def build(bld):
target=x.change_ext('.pdf'),
)
bld(
target='generated.tex',
rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name),
)
bld(
features='rst',
type='rst2latex',