X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fadd_html_footer.py;fp=buildscripts%2Fadd_html_footer.py;h=83a52dc7264c1ede68ade59653e18b9009a14386;hb=beb52c9966a934559684caebce7acc2b326d316e;hp=5a459784825f1d1bf0955a07b05f75df67a52677;hpb=a398cb2b73918a9132eb692e7540e7b8c48f49bd;p=lilypond.git diff --git a/buildscripts/add_html_footer.py b/buildscripts/add_html_footer.py index 5a45978482..83a52dc726 100644 --- a/buildscripts/add_html_footer.py +++ b/buildscripts/add_html_footer.py @@ -94,9 +94,7 @@ def source_links_replace (m, source_val): splitted_docs_re = re.compile ('(input/lsr/out-www/lilypond-snippets|Documentation/user/out-www/(lilypond|music-glossary|lilypond-program|lilypond-learning))/') snippets_ref_re = re.compile (r'href="(\.\./)?lilypond-snippets') -# TODO: master has ../lily- ! -src_href_re = re.compile ('(href|src)="(lily-.*?|.*?[.]png)"') -source_link_re = re.compile ('href="source/(.*?)"') +user_ref_re = re.compile (r'href="(?:\.\./)?lilypond(|-internals|-learning|-program)') ## Windows does not support symlinks. # This function avoids creating symlinks for splitted HTML manuals @@ -104,16 +102,19 @@ source_link_re = re.compile ('href="source/(.*?)"') # this also fixes missing PNGs only present in translated docs def hack_urls (s, prefix): if splitted_docs_re.match (prefix): - s = src_href_re.sub ('\\1="../\\2"', s) + s = re.sub ('(href|src)="(../lily-.*?|.*?[.]png)"', '\\1="../\\2"', s) - # fix Snippets xrefs ad hoc - s = snippets_ref_re.sub ('href="source/input/lsr/lilypond-snippets', s) + # fix xrefs between documents in different directories ad hoc + if 'user/out-www/lilypond' in 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) source_path = os.path.join (os.path.dirname (prefix), 'source') if not os.path.islink (source_path): return s source_val = os.readlink (source_path) - return source_link_re.sub (lambda m: source_links_replace (m, source_val), s) + return re.sub ('href="source/(.*?)"', lambda m: source_links_replace (m, source_val), s) body_tag_re = re.compile ('(?i)]*)>') html_tag_re = re.compile ('(?i)')