X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fpostprocess_html.py;h=e94da797559b224694a7caae817408310f9b0d4d;hb=d33755b99acab3bcf9367ebe83663463778c4b88;hp=89d88753609a23211fdf4ad0ef7ef7166ceb28e9;hpb=f00e54157c3cd9e04f9b9100641a766fb036b56e;p=lilypond.git diff --git a/buildscripts/postprocess_html.py b/buildscripts/postprocess_html.py index 89d8875360..e94da79755 100644 --- a/buildscripts/postprocess_html.py +++ b/buildscripts/postprocess_html.py @@ -99,6 +99,9 @@ snippets_ref_re = re.compile (r'href="(\.\./)?lilypond-snippets') user_ref_re = re.compile ('href="(?:\.\./)?lilypond\ (-internals|-learning|-program|(?!-snippets))') +docindex_link_re = re.compile (r'href="index.html"') + + ## Windows does not support symlinks. # This function avoids creating symlinks for splitted HTML manuals # Get rid of symlinks in GNUmakefile.in (local-WWW-post) @@ -112,6 +115,18 @@ def hack_urls (s, prefix): s = snippets_ref_re.sub ('href="source/input/lsr/lilypond-snippets', s) elif 'input/lsr' in prefix: s = user_ref_re.sub ('href="source/Documentation/user/lilypond\\1', s) + + # we also need to replace in the lsr, which is already processed above! + if 'input/' in prefix or 'Documentation/topdocs' in prefix: + # fix the link from the regtest, lsr and topdoc pages to the doc index + # (rewrite prefix to obtain the relative path of the doc index page) + rel_link = re.sub (r'out-www/.*$', '', prefix) + rel_link = re.sub (r'[^/]*/', '../', rel_link) + if 'input/regression' in prefix: + indexfile = "Documentation/devel" + else: + indexfile = "index" + s = docindex_link_re.sub ('href="' + rel_link + indexfile + '.html\"', s) source_path = os.path.join (os.path.dirname (prefix), 'source') if not os.path.islink (source_path): @@ -123,9 +138,16 @@ body_tag_re = re.compile ('(?i)]*)>') html_tag_re = re.compile ('(?i)') doctype_re = re.compile ('(?i)\n' -css_re = re.compile ('(?i)]*?lilypond.css"([^>]*)>') +css_re = re.compile ('(?i)]*)href="[^">]*?lilypond.*\.css"([^>]*)>') end_head_tag_re = re.compile ('(?i)') -css_link = '\n' +css_link = """ + + + +""" + def add_header (s, prefix): """Add header (, doctype and CSS)""" @@ -144,7 +166,7 @@ def add_header (s, prefix): if css_re.search (s) == None: depth = (prefix.count ('/') - 1) * '../' - s = end_head_tag_re.sub ((css_link % depth) + '', s) + s = end_head_tag_re.sub ((css_link % {'rel': depth}) + '', s) return s title_tag_re = re.compile ('.*?(.*?)', re.DOTALL)