mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-25 03:09:30 +01:00
Fix the example in playground/rst
This commit is contained in:
parent
43c5ae670a
commit
68f84f9084
@ -3,6 +3,8 @@
|
||||
import os, re, subprocess
|
||||
from waflib import Options, TaskGen, Utils
|
||||
|
||||
top = out = '.'
|
||||
|
||||
def options(opt):
|
||||
opt.load('rst')
|
||||
opt.load('tex')
|
||||
@ -20,32 +22,20 @@ def build(bld):
|
||||
|
||||
bld(
|
||||
target='generated.rst',
|
||||
rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name),
|
||||
rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name),
|
||||
)
|
||||
|
||||
|
||||
bld(
|
||||
target='generated.csv',
|
||||
rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "a,b,c\n1,2,%s" % tsk.outputs[0].name),
|
||||
rule=lambda tsk: tsk.outputs[0].write("a,b,c\n1,2,%s" % tsk.outputs[0].name),
|
||||
)
|
||||
|
||||
|
||||
bld(
|
||||
target='generated.html',
|
||||
rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "<p>Generated HTML data</p>"),
|
||||
rule=lambda tsk: tsk.outputs[0].write("<p>Generated HTML data</p>"),
|
||||
)
|
||||
|
||||
bld(
|
||||
features='rst',
|
||||
target='test1.html',
|
||||
source='test1.rst',
|
||||
)
|
||||
|
||||
bld(
|
||||
features='rst',
|
||||
target='test1.pdf',
|
||||
source='test1.rst',
|
||||
)
|
||||
|
||||
for x in bld.path.ant_glob("**/*.svg"):
|
||||
for x in bld.path.ant_glob("**/*.svg", remove=False):
|
||||
bld(
|
||||
rule='inkscape --export-area-drawing --export-png=${TGT[0].bldpath()} ${SRC[0].bldpath()}',
|
||||
source=x,
|
||||
@ -57,9 +47,24 @@ def build(bld):
|
||||
target=x.change_ext('.pdf'),
|
||||
)
|
||||
|
||||
bld.add_group()
|
||||
|
||||
bld(
|
||||
features='rst',
|
||||
target='test1.html',
|
||||
source='test1.rst',
|
||||
)
|
||||
|
||||
if bld.env.RST2PDF:
|
||||
bld(
|
||||
features='rst',
|
||||
target='test1.pdf',
|
||||
source='test1.rst',
|
||||
)
|
||||
|
||||
bld(
|
||||
target='generated.tex',
|
||||
rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name),
|
||||
rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name)),
|
||||
)
|
||||
|
||||
bld(
|
||||
|
@ -39,7 +39,7 @@ rst_progs = "rst2html rst2xetex rst2latex rst2xml rst2pdf rst2s5 rst2man rst2odt
|
||||
def parse_rst_node(task, node, nodes, names, seen, dirs=None):
|
||||
# TODO add extensibility, to handle custom rst include tags...
|
||||
if dirs is None:
|
||||
dirs = (node.parent,node.get_bld().parent)
|
||||
dirs = (node.parent, node.parent.get_bld())
|
||||
|
||||
if node in seen:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user