mirror of https://gitlab.com/ita1024/waf.git
playground: rst: more demos
This commit is contained in:
parent
459f04cbee
commit
6d5cbfc3e6
|
@ -4,12 +4,18 @@ Example 1
|
||||||
|
|
||||||
:purpose: demonstrate basic rst processing
|
:purpose: demonstrate basic rst processing
|
||||||
|
|
||||||
|
Static SVG Picture
|
||||||
|
##################
|
||||||
|
|
||||||
.. figure:: test.svg
|
.. figure:: test.svg
|
||||||
:align: center
|
:align: center
|
||||||
:width: 50%
|
:width: 50%
|
||||||
|
|
||||||
This is a static svg file
|
This is a static svg file
|
||||||
|
|
||||||
|
Generated PNG Picture
|
||||||
|
#####################
|
||||||
|
|
||||||
.. figure:: test.png
|
.. figure:: test.png
|
||||||
:align: center
|
:align: center
|
||||||
:width: 50%
|
:width: 50%
|
||||||
|
@ -20,19 +26,44 @@ Example 1
|
||||||
As of 2013-08-25, rst2pdf and docutils do not have
|
As of 2013-08-25, rst2pdf and docutils do not have
|
||||||
some way of specifying include paths, in which includes
|
some way of specifying include paths, in which includes
|
||||||
are searched.
|
are searched.
|
||||||
|
|
||||||
So the figure is broken.
|
So the figure is broken.
|
||||||
|
|
||||||
We could generate the figure in the source directory,
|
We could generate the figure in the source directory,
|
||||||
but I prefer not having a figure at all for the sake
|
but I prefer not having a figure at all for the sake
|
||||||
of cleanleness.
|
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
|
.. 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::
|
.. csv-table::
|
||||||
:file: generated.csv
|
:file: generated.csv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Generated Content using raw Directive
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
The following line will be empty if not using the HTML
|
||||||
|
output.
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated.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.
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,42 @@ Example 2
|
||||||
|
|
||||||
:purpose: demonstrate rst processing through rst2latex
|
:purpose: demonstrate rst processing through rst2latex
|
||||||
|
|
||||||
|
Generated PDF Picture
|
||||||
|
#####################
|
||||||
|
|
||||||
.. figure:: test.pdf
|
.. figure:: test.pdf
|
||||||
:align: center
|
:align: center
|
||||||
:width: 50%
|
: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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,11 @@ def build(bld):
|
||||||
target=x.change_ext('.pdf'),
|
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(
|
bld(
|
||||||
features='rst',
|
features='rst',
|
||||||
type='rst2latex',
|
type='rst2latex',
|
||||||
|
|
Loading…
Reference in New Issue