]> git.donarmstrong.com Git - lilypond.git/commitdiff
Web build: make better links for stable.
authorGraham Percival <graham@percival-music.ca>
Mon, 28 Dec 2009 21:41:53 +0000 (21:41 +0000)
committerGraham Percival <graham@percival-music.ca>
Mon, 28 Dec 2009 21:41:53 +0000 (21:41 +0000)
I shouldn't be allowed to use anything other than lily-git; I lost
this work from my local git repo when I was trying to fix it from
briefly going back to 2.12.2.  Fortunately I'd already uploaded it
into lilypond.org:lilypond/trusted-scripts, so I could restore
from that backup.

scripts/build/create-version-itexi.py

index 0a50a466fe7b22268ad5aa04a2d38156fe9e5da9..40b4aca1a100968528d683e17bf02ee09256d9de 100644 (file)
@@ -18,10 +18,6 @@ depth = "../../"
 # these links are relative from the v2.13 docs
 #depth = "../../../../"
 
-# FIXME: remove the user/lilypond-  when 2.14 becomes stable
-WEB_DOCLINK_STABLE = depth + "doc/v2.12/Documentation/user/lilypond-"
-WEB_DOCLINK_DEVEL  = depth + "doc/v2.13/Documentation/"
-
 
 
 VERSION_STABLE = ""
@@ -113,17 +109,38 @@ def make_all_downloads(macroName, version):
 
 def make_ver_link(macroname, version, url, linktext):
     string = "@uref{"
-    # TODO: generalize this
-    if (version[:4] == '2.13'):
-        string += WEB_DOCLINK_DEVEL
-    if (version[:4] == '2.12'):
-        string += WEB_DOCLINK_STABLE
     string += url
     string += ","
     string += linktext
     string += "}"
     make_macro(macroname, string)
 
+# TODO: this kind of thing should really be in a central place for
+# lilypond python build scripts
+def translateNameToUrl(manual, version):
+    ver_split = version.split('.')
+    ver_minor = ver_split[0] + '.' + ver_split[1]
+    url = depth + "doc/v" + ver_minor + "/Documentation/"
+
+    if (ver_minor == '2.13'):
+        return url+manual
+    if (ver_minor == '2.12'):
+        if (manual=='learning'):
+            return url+'user/lilypond-learning'
+        if (manual=='internals'):
+            return url+'user/lilypond-internals'
+        if (manual=='notation'):
+            return url+'user/lilypond'
+        if (manual=='usage'):
+            return url+'user/lilypond-program'
+        if (manual=='snippets'):
+            return url+'../input/lsr/lilypond-snippets'
+        elif (manual=='music-glossary'):
+            return url+'user/music-glossary'
+        else:
+            return ''
+
+
 def make_manual_links(name, version):
     for m in manuals:
         manual = m
@@ -131,17 +148,31 @@ def make_manual_links(name, version):
             mshort = 'glossary'
         else:
             mshort = m
+        url = translateNameToUrl(m, version)
+
+        if (url == ''):
+            # can't have a comma here due to texinfo
+            make_ver_link("manual"+name+mshort.capitalize()+'Pdf',
+                version, "http://lilypond.org",
+                "Sorry; this manual did not exist in 2.12")
+            make_ver_link("manual"+name+mshort.capitalize()+'Split',
+                version, "http://lilypond.org",
+                "Sorry; this manual did not exist in 2.12")
+            make_ver_link("manual"+name+mshort.capitalize()+'Big',
+                version, "http://lilypond.org",
+                "Sorry; this manual did not exist in 2.12")
+            continue
         make_ver_link("manual"+name+mshort.capitalize()+'Pdf',
                   version,
-                  manual + '.pdf',
+                  url + '.pdf',
                   manual.capitalize() + '.pdf')
         make_ver_link("manual"+name+mshort.capitalize()+'Split',
                   version,
-                  manual+'/index.html',
+                  url + '/index.html',
                   manual.capitalize() + ' (split HTML)')
         make_ver_link("manual"+name+mshort.capitalize()+'Big',
                   version,
-                  manual+'-big-page.html',
+                  url + '-big-page.html',
                   manual.capitalize() + ' (big HTML)')