]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/auxiliar/postprocess_html.py
Add vector constructor with size argument
[lilypond.git] / python / auxiliar / postprocess_html.py
index 9c0d90dc2fd031046252c59c4bda207a9420783b..3ace451bf083ce6ecec467d4b497d8f6b716a095 100644 (file)
@@ -102,7 +102,7 @@ def source_links_replace (m, source_val):
     return 'href="' + os.path.join (source_val, m.group (1)) + '"'
 
 # More hardcoding, yay!
-splitted_docs_re = re.compile('(Documentation/out-www/(automated-engraving|essay|notation|changes|extending|music-glossary|usage|web|learning|snippets|contributor))/')
+split_docs_re = re.compile('(Documentation/out-www/(automated-engraving|essay|notation|changes|extending|music-glossary|usage|web|learning|snippets|contributor))/')
 lily_snippets_re = re.compile ('(href|src)="([0-9a-f]{2}/lily-.*?)"')
 pictures_re = re.compile ('src="(pictures/.*?)"')
 
@@ -110,11 +110,14 @@ docindex_link_re = re.compile (r'href="index.html"')
 manuals_page_link_re = re.compile (r'href="((?:\.\./)+)Documentation/web/manuals')
 
 ## Windows does not support symlinks.
-# This function avoids creating symlinks for splitted HTML manuals
+# This function avoids creating symlinks for split HTML manuals
 # Get rid of symlinks in GNUmakefile.in (local-WWW-post)
 # this also fixes missing PNGs only present in translated docs
 def hack_urls (s, prefix, target, is_development_branch):
-    if splitted_docs_re.match (prefix):
+    depth = (prefix.count ('/') - 1) * '../'
+    # fix css links
+    s = css_re.sub ('<link \\1href="%(rel)sDocumentation/css/\\2"\\3>' % {'rel': depth}, s)
+    if split_docs_re.match (prefix):
         s = lily_snippets_re.sub ('\\1="../\\2"', s)
         s = pictures_re.sub ('src="../\\1"', s)
 
@@ -149,11 +152,11 @@ body_tag_re = re.compile ('(?i)<body([^>]*)>')
 html_tag_re = re.compile ('(?i)<html>')
 doctype_re = re.compile ('(?i)<!DOCTYPE')
 doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n'
-css_re = re.compile ('(?i)<link rel="stylesheet" type="text/css" ([^>]*)href="[^">]*?lilypond.*\.css"([^>]*)>')
+css_re = re.compile ('(?i)<link ([^>]*)href="[^">]*?(lilypond.*\.css)"([^>]*)>')
 end_head_tag_re = re.compile ('(?i)</head>')
-css_link = """    <link rel="stylesheet" type="text/css" title="Default design" href="%(rel)sDocumentation/lilypond-manuals.css">
+css_link = """    <link rel="stylesheet" type="text/css" title="Default design" href="%(rel)sDocumentation/css/lilypond-manuals.css">
     <!--[if lte IE 7]>
-    <link href="%(rel)sDocumentation/lilypond-ie-fixes.css" rel="stylesheet" type="text/css">
+    <link href="%(rel)sDocumentation/css/lilypond-ie-fixes.css" rel="stylesheet" type="text/css">
     <![endif]-->
 """