mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 18:07:12 +01:00
extras: rst: extend parse_rst_node()
This commit is contained in:
parent
2999a120a1
commit
c923c31031
@ -36,8 +36,11 @@ from waflib.TaskGen import feature, before_method
|
|||||||
|
|
||||||
rst_progs = "rst2html rst2xetex rst2latex rst2xml rst2pdf rst2s5 rst2man rst2odt rst2rtf".split()
|
rst_progs = "rst2html rst2xetex rst2latex rst2xml rst2pdf rst2s5 rst2man rst2odt rst2rtf".split()
|
||||||
|
|
||||||
def parse_rst_node(node, nodes, names, seen):
|
def parse_rst_node(task, node, nodes, names, seen, dirs=None):
|
||||||
# TODO add extensibility, to handle custom rst include tags...
|
# TODO add extensibility, to handle custom rst include tags...
|
||||||
|
if dirs is None:
|
||||||
|
dirs = (node.parent,node.get_bld().parent)
|
||||||
|
|
||||||
if node in seen:
|
if node in seen:
|
||||||
return
|
return
|
||||||
seen.append(node)
|
seen.append(node)
|
||||||
@ -47,12 +50,17 @@ def parse_rst_node(node, nodes, names, seen):
|
|||||||
ipath = match.group('file')
|
ipath = match.group('file')
|
||||||
itype = match.group('type')
|
itype = match.group('type')
|
||||||
Logs.debug("rst: visiting %s: %s" % (itype, ipath))
|
Logs.debug("rst: visiting %s: %s" % (itype, ipath))
|
||||||
found = node.parent.find_resource(ipath)
|
found = False
|
||||||
if found:
|
for d in dirs:
|
||||||
nodes.append(found)
|
Logs.debug("rst: looking for %s in %s" % (ipath, d.abspath()))
|
||||||
if itype == 'include':
|
found = d.find_node(ipath)
|
||||||
parse_rst_node(found, nodes, names, seen)
|
if found:
|
||||||
else:
|
Logs.debug("rst: found %s as %s" % (ipath, found.abspath()))
|
||||||
|
nodes.append(found)
|
||||||
|
if itype == 'include':
|
||||||
|
parse_rst_node(task, found, nodes, names, seen)
|
||||||
|
break
|
||||||
|
if not found:
|
||||||
names.append(ipath)
|
names.append(ipath)
|
||||||
|
|
||||||
class docutils(Task.Task):
|
class docutils(Task.Task):
|
||||||
@ -74,7 +82,7 @@ class docutils(Task.Task):
|
|||||||
if not node:
|
if not node:
|
||||||
return (nodes, names)
|
return (nodes, names)
|
||||||
|
|
||||||
parse_rst_node(node, nodes, names, seen)
|
parse_rst_node(self, node, nodes, names, seen)
|
||||||
|
|
||||||
Logs.debug("rst: %s: found the following file deps: %s" % (repr(self), nodes))
|
Logs.debug("rst: %s: found the following file deps: %s" % (repr(self), nodes))
|
||||||
if names:
|
if names:
|
||||||
|
Loading…
Reference in New Issue
Block a user