+set_gcos ()
+localtime = time.strftime ('%c %Z', time.localtime (time.time ()))
+
+if os.path.basename (index_url) != "index.html":
+ index_url = os.path.join (index_url , "index.html")
+top_url = os.path.dirname (index_url) + "/"
+
+header = compose (default_header, header_file)
+footer = compose (default_footer, footer_file) + built
+header_tag = '<!-- header_tag -->'
+footer_tag = '<!-- footer_tag -->'
+
+# Python < 1.5.2 compatibility
+#
+# On most platforms, this is equivalent to
+#`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2*
+if os.path.__dict__.has_key ('abspath'):
+ abspath = os.path.abspath
+else:
+ def abspath (path):
+ return os.path.normpath (os.path.join (os.getcwd (), path))
+
+
+def remove_self_ref (s):
+ self_url = abspath (os.getcwd () + '/' + f)
+ #sys.stderr.write ('url0: %s\n' % self_url)
+
+ # self_url = re.sub ('.*?' + string.lower (package_name) + '[^/]*/',
+ # '', self_url)
+ # URG - this only works when source tree is unpacked in `src/' dir
+ # For some reason, .*? still eats away
+ # /home/fred/usr/src/lilypond-1.5.14/Documentation/user/out-www/lilypond/
+ # instead of just
+ #
+ # /home/fred/usr/src/lilypond-1.5.14/
+ #
+ # Tutorial.html
+ self_url = re.sub ('.*?src/' + string.lower (package_name) + '[^/]*/',
+ '', self_url)
+
+ #sys.stderr.write ('url1: %s\n' % self_url)
+
+ #urg, ugly lily-specific toplevel index hack
+ self_url = re.sub ('.*topdocs/out-www/index.html', 'index.html', self_url)
+ #sys.stderr.write ('url2: %s\n' % self_url)
+
+ m = re.match ('.*?(<a href="[\./]*' + self_url + '#?[^"]*">)([^<]*)(</a>)',
+ s, re.DOTALL)
+ while m:
+ #sys.stderr.write ('self: %s\n' % m.group (2))
+ s = s[:m.start (1)] + m.group (2) + s[m.end (3):]
+ m = re.match ('.*?(<a href="[\./]*' + self_url + '#?[^"]*">)([^<]*)(</a>)',
+ s, re.DOTALL)
+ return s
+
+def do_file (f):
+ s = gulp_file (f)