From 8576c41a0675ac1b0df93041f77fcc9ce629d84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 10 Apr 2014 17:43:28 +0200 Subject: [PATCH] the post processing also collects fig anchors in the reference manual pages --- Documentation/html_output_post_processing.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Documentation/html_output_post_processing.py b/Documentation/html_output_post_processing.py index 113c491ee34..36cf3228d91 100755 --- a/Documentation/html_output_post_processing.py +++ b/Documentation/html_output_post_processing.py @@ -188,19 +188,24 @@ def automagically_number_figures(): for el in d('a.elRef'): text = pq(el).attr('href') if text.find("index.html")!=-1: - re_pkg_index=re.compile("\.\./([A-Z_a-z0-9]+/index\.html)") + re_pkg_index=re.compile("\.\./([A-Z_a-z0-9]+)/index\.html") res=re_pkg_index.match(text) if res: all_packages.append(res.group(1)) else: stderr.write("Error: Figure numbering; skipping "+text+"\n") - #collect all the figure anchors in user manual and associate them a unique id + #collect all the figure anchors and associate them a unique id pkg_id=1 # the id of a package global_anchor_map={} #map a figure anchor to it unique name: pkg_id+.+fig_nb - for fname in all_packages: - infos=figure_anchor_info(pkg_id, global_anchor_map) - d = pq(filename=fname, parser='html') - d('a.anchor').each( lambda i: collect_figure_anchors(i,infos) ) + for pkg_name in all_packages: + # collect first in the user manual + userman=os.path.join(pkg_name,"index.html") + all_pkg_files=glob.glob(os.path.join(pkg_name,"*.html")) + all_pkg_files.remove(userman) + for fname in [userman]+all_pkg_files: + infos=figure_anchor_info(pkg_id, global_anchor_map) + d = pq(filename=fname, parser='html') + d('a.anchor').each( lambda i: collect_figure_anchors(i,infos) ) pkg_id+=1 #Figure link dev Manual