X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fadd_html_footer.py;h=1721ad71872a4484c1e2e7c7cb4b63f97c012007;hb=afa735da6739e71af13bc2258b17a0f4e411cec1;hp=5722bca35213fc9b99eebe2f9221f7158f960eb2;hpb=96b013a38db7d58e5d7c32432d912b6de04d4b35;p=lilypond.git
diff --git a/buildscripts/add_html_footer.py b/buildscripts/add_html_footer.py
index 5722bca352..1721ad7187 100644
--- a/buildscripts/add_html_footer.py
+++ b/buildscripts/add_html_footer.py
@@ -6,7 +6,6 @@ Print a nice footer.
import re
import os
import time
-import gettext
import langdefs
@@ -16,15 +15,14 @@ non_copied_pages = ['Documentation/user/out-www/lilypond-big-page',
'Documentation/user/out-www/lilypond-internals-big-page',
'Documentation/user/out-www/music-glossary-big-page',
'out-www/examples',
- 'Documentation/topdocs/out-www/NEWS',
- 'Documentation/topdocs/out-www/INSTALL',
- 'Documentation/bibliography/out-www/index',
- 'Documentation/bibliography/out-www/engraving',
- 'Documentation/bibliography/out-www/colorado',
- 'Documentation/bibliography/out-www/computer-notation'
+ 'Documentation/topdocs',
+ 'Documentation/bibliography',
'Documentation/out-www/THANKS',
'Documentation/out-www/DEDICATION',
- 'Documentation/topdocs/out-www/AUTHORS']
+ 'input/']
+
+def _doc (s):
+ return s
header = r"""
"""
@@ -33,24 +31,29 @@ footer = '''
-''' + _ ('This page is for %(package_name)s-%(package_version)s (%(branch_str)s).') + '''
+%(footer_name_version)s
+
+
+%(footer_report_errors)s
+
+%(footer_suggest_docs)s
-
-''' + _ ('Report errors to %(mail_address)s.') + '''
'''
+footer_name_version = _doc ('This page is for %(package_name)s-%(package_version)s (%(branch_str)s).')
+footer_report_errors = _doc ('Report errors to %(mail_address)s.')
+# ugh, must not have "_doc" in strings because it is naively replaced with "_" in hacked gettext process
+footer_suggest_docs = _doc ('Your suggestions for the documentation are welcome.')
mail_address = 'http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs'
+suggest_Docs_url = 'http://lilypond.org/web/devel/participating/documentation-adding'
header_tag = ''
footer_tag = ''
-def _ (s):
- return s
-
-language_available = _ ("Other languages: %s.")
-browser_language = _ ('About automatic language selection.')
+lang_available = _doc ("Other languages: %s.")
+browser_lang = _doc ('About automatic language selection.')
browser_language_url = "/web/about/browser-language"
LANGUAGES_TEMPLATE = '''
@@ -81,6 +84,23 @@ def build_pages_dict (filelist):
else:
pages_dict[g[0]].append (e)
+def source_links_replace (m, source_val):
+ return 'href="' + os.path.join (source_val, m.group (1)) + '"'
+
+splitted_docs_re = re.compile ('Documentation/user/out-www/(lilypond|music-glossary|lilypond-program|lilypond-learning)/')
+
+# On systems without symlinks (e.g. Windows), docs are not very usable
+# Get rid of symlinks references here
+# Get rid of symlinks in GNUmakefile.in (local-WWW-post)
+def replace_symlinks_urls (s, prefix):
+ if splitted_docs_re.match (prefix):
+ s = re.sub ('(href|src)="(lily-.*?|.*?-flat-.*?)"', '\\1="../\\2"', 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 re.sub ('href="source/(.*?)"', lambda m: source_links_replace (m, source_val), s)
+
def add_header (s):
"""Add header ( and doctype)"""
if re.search (header_tag, s) == None:
@@ -100,10 +120,6 @@ def add_header (s):
s = doctype + s
return s
-def info_external_ref_remove (s):
- """Remove info's annoying's indication of referencing external document"""
- return re.sub (' \((lilypond|lilypond-internals|music-glossary)\)', '', s)
-
def add_title (s):
# urg
# maybe find first node?
@@ -147,7 +163,7 @@ def find_translations (prefix, lang_ext):
if lang_ext != e:
if e in pages_dict[prefix]:
available.append (l)
- elif lang_ext == '' and l.enabled and not prefix in non_copied_pages:
+ elif lang_ext == '' and l.enabled and reduce (lambda x, y: x and y, [not prefix.startswith (s) for s in non_copied_pages]):
# English version of missing translated pages will be written
missing.append (e)
return available, missing
@@ -185,7 +201,7 @@ def add_menu (page_flavors, prefix, available, target, translation):
if page_flavors[k][0] != '':
t = translation[page_flavors[k][0]]
else:
- t = _
+ t = _doc
for lang in available:
lang_file = lang.file_name (os.path.basename (prefix), '.html')
if language_menu != '':
@@ -194,9 +210,9 @@ def add_menu (page_flavors, prefix, available, target, translation):
if target == 'offline':
browser_language = ''
elif target == 'online':
- browser_language = t (browser_language) % browser_language_url
+ browser_language = t (browser_lang) % browser_language_url
if language_menu:
- language_available = t (language_available) % language_menu
+ language_available = t (lang_available) % language_menu
languages = LANGUAGES_TEMPLATE % vars ()
# put language menu before '' and '