rm -rf $(outdir)/online-root
rm -rf $(outdir)/offline-root
$(PYTHON) $(buildscript-dir)/www_post.py $(PACKAGE_NAME) $(TOPLEVEL_VERSION) $(buildscript-dir) $(top-build-dir)/Documentation/po/$(outdir) $(outdir) "$(WEB_TARGETS)"
+ find $(outdir)/offline-root -type l -delete
tree-prefix = $(outdir)
else:
pages_dict[g[0]].append (e)
+def source_links_replace (m, source_val):
+ return 'href="' + os.path.join (source_val, m.group (1)) + '"'
+
+# On systems without symlinks (e.g. Windows), docs are not very usable
+# Get rid of symlinks here (also in GNUmakefile.in (local-WWW-post))
+def replace_symlinks_urls (s, prefix):
+ if prefix.startswith ('Documentation/user/'):
+ 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 (<BODY> and doctype)"""
if re.search (header_tag, s) == None:
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)\)</a>', '</a>', s)
-
def add_title (s):
# urg
# maybe find first node?
in_f.close()
s = re.sub ('%', '%%', s)
+ if target == 'offline':
+ s = replace_symlinks_urls (s, prefix)
s = add_header (s)
- # seems to be no more needed
- # s = info_external_ref_remove (s)
### add footer
if re.search (footer_tag, s) == None:
page_flavors = process_links (s, prefix, lang_ext, file_name, missing, target)
# Add menu after stripping: must not have autoselection for language menu.
page_flavors = add_menu (page_flavors, prefix, available, target, translation)
- # urg, this stuff is outdated and seems useless, let's disable it
- #else:
- # for e in [l.webext for l in langdefs.LANGUAGES]:
- # if not e in pages_dict[prefix]:
- # page_flavors[langdefs.lang_file_name (prefix, e, '.html')] = s
subst = dict ([i for i in globals().items() if type (i[1]) is str])
subst.update (dict ([i for i in locals().items() if type (i[1]) is str]))
for k in page_flavors.keys():
#
# create hard or symbolic links to SOURCEDIR/FILES in DESTDIR
#
-# if --prepend-suffix is specified, link to foo.bar will be called fooSUFFIX.bar
-# shell-wildcard expansion is performed on FILES.
-
-print "mass_link.py"
+# If --prepend-suffix is specified, link to foo.bar will be called fooSUFFIX.bar.
+# Shell wildcards expansion is performed on FILES.
import sys
import os
import glob
import getopt
+print "mass-link.py"
+
optlist, args = getopt.getopt (sys.argv[1:], '', ['prepend-suffix='])
link_type, source_dir, dest_dir = args[0:3]
files = args[3:]
+source_dir = os.path.normpath (source_dir)
+dest_dir = os.path.normpath (dest_dir)
+
prepended_suffix = ''
for x in optlist:
if x[0] == '--prepend-suffix':
for pattern in files:
sourcefiles += (glob.glob (os.path.join (source_dir, pattern)))
-destfiles = map (lambda f: os.path.join (dest_dir, insert_suffix (os.path.basename (f))), sourcefiles)
+def relative_path (f):
+ if source_dir == '.':
+ return f
+ return f[len (source_dir) + 1:]
+
+destfiles = map (lambda f: os.path.join (dest_dir, insert_suffix (relative_path (f))), sourcefiles)
def force_link (src,dest):
if os.path.exists (dest):
target_pattern = os.path.join (outdir, '%s-root')
static_files = {
- # ugly hack: the following overwrites HTML Info dir with a link to
- # the (more useful) documentation index
- os.path.join ('Documentation/user', outdir, 'index.html'):
- '''<META HTTP-EQUIV="refresh" content="0;URL=../index.html">
-<html><body>Redirecting to the documentation index...</body></html>\n''',
os.path.join (outdir, 'index.html'):
'''<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">
<html><body>Redirecting to the documentation index...</body></html>\n''',
os.path.join (outdir, 'VERSION'):
package_version + '\n' }
+import langdefs
+
+# ugly hack: the following overwrites HTML Info dir with a link to
+# the (more useful) documentation index
+for l in langdefs.LANGUAGES:
+ static_files[os.path.join ('Documentation/user', outdir, l.file_name ('index', '.html'))] = \
+ '<META HTTP-EQUIV="refresh" content="0;URL=../' + l.file_name ('index', '.html') + \
+ '">\n<html><body>Redirecting to the documentation index...</body></html>\n'
+
for f, contents in static_files.items ():
open (f, 'w').write (contents)
sys.path.append (buildscript_dir)
import mirrortree
import add_html_footer
-import langdefs
sys.stderr.write ("Mirrorring...\n")
dirs, symlinks, files = mirrortree.walk_tree (
cd $(outdir); texi2pdf --batch $(TEXINFO_PAPERSIZE_OPTION) $(notdir $*).pdftexi
local-WWW: $(outdir)/lilypond.pdf $(outdir)/lilypond/index.html
- find $(outdir) -name '*.html' | xargs grep -L --label="" 'UNTRANSLATED NODE: IGNORE ME' | xargs $(PYTHON) $(buildscript-dir)/mass-link.py --prepend-suffix .$(ISOLANG) hard . $(depth)/Documentation/user/$(outdir) $(outdir)/lilypond.pdf
+ cd $(outdir); find -name '*.html' | xargs grep -L --label="" 'UNTRANSLATED NODE: IGNORE ME' | xargs $(PYTHON) ../$(buildscript-dir)/mass-link.py --prepend-suffix .$(ISOLANG) hard . $(top-build-dir)/Documentation/user/$(outdir) lilypond.pdf
# ugh, this is not enough to avoid wasting build time, $(outdir)/user-ln should be touched for all languages
touch -mr $(top-build-dir)/Documentation/user/$(outdir) $(outdir)/user-ln