Web build: fix links to manuals.
authorGraham Percival <graham@percival-music.ca>
Sun, 14 Mar 2010 00:01:00 +0000 (00:01 +0000)
committerGraham Percival <graham@percival-music.ca>
Sun, 14 Mar 2010 00:20:38 +0000 (00:20 +0000)
Also avoid translating links to non-translated manual.

scripts/build/website_post.py

index 619693c4926389ac5c552f780afe7b75eb0d1ee8..f0b20b9fdef224ed713935d092c02ef20f837d76 100644 (file)
@@ -22,11 +22,11 @@ lang_other_langs = {
     '': 'Other languages: '
 }
 
-exclude_pages = [
-    'music-glossary',
-    'snippets',
-    'internals',
-    'contributor'
+exclude_manuals = [
+    '/music-glossary',
+    '/snippets',
+    '/internals',
+    '/contributor'
 ]
 
 ###### Actual program
@@ -57,7 +57,11 @@ langs.sort()
 ### helper functions
 def addLangExt(filename, lang, ext):
     text = filename
-    if (not (lang=="")):
+    exclude = 0
+    for dir in exclude_manuals:
+        if (text.find(dir) >= 0):
+            exclude = 1
+    if (not (exclude or (lang==""))):
         text += "." + lang
     text += "." + ext
     return text
@@ -136,12 +140,12 @@ for file in html_files:
         ### alter links as appropriate
         link = getLocalHref(line)
         if (link != ""):
-            link_base = link.split('.')[0]
+            # quesitonable
             if (link.endswith(".html")):
-               langlink = addLangExt(link_base, lang, "html")
+               langlink = addLangExt(link[:-5], lang, "html")
                 line = line.replace(link, langlink)
             if (link.endswith(".pdf")):
-               langlink = addLangExt(link_base, lang, "pdf")
+               langlink = addLangExt(link[:-4], lang, "pdf")
                 line = line.replace(link, langlink)
         ### add language selection footer
         if (line.find("<!-- FOOTER -->") >= 0):