]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/build/lys-to-tely.py
resolve merge
[lilypond.git] / scripts / build / lys-to-tely.py
index c9d698f92cea0764b2e608a7bda5c4b75b9f35a6..c4e387547b18563b5fe6ba81e4f05fbf90e61129 100644 (file)
@@ -27,6 +27,7 @@ Options:
    options
  -o, --output=NAME              write tely doc to NAME
  -t, --title=TITLE              set tely doc title TITLE
+ -a, --author=AUTHOR            set tely author AUTHOR
      --template=TEMPLATE        use TEMPLATE as Texinfo template file,
    instead of standard template; TEMPLATE should contain a command
    '%(include_snippets)s' to tell where to insert LY-FILEs.  When this
@@ -38,10 +39,11 @@ def help (text):
     sys.exit (0)
 
 (options, files) = getopt.getopt (sys.argv[1:], 'f:hn:t:',
-                     ['fragment-options=', 'help', 'name=', 'title=', 'template='])
+                     ['fragment-options=', 'help', 'name=', 'title=', 'author=', 'template='])
 
 name = "ly-doc"
 title = "Ly Doc"
+author = "Han-Wen Nienhuys and Jan Nieuwenhuizen"
 template = '''\input texinfo
 @setfilename %%(name)s.info
 @settitle %%(title)s
@@ -55,7 +57,7 @@ template = '''\input texinfo
 
 @c fool ls-latex
 @ignore
-@author Han-Wen Nienhuys and Jan Nieuwenhuizen
+@author %%(author)s
 @title %%(title)s
 @end ignore
 
@@ -71,14 +73,16 @@ for opt in options:
     o = opt[0]
     a = opt[1]
     if o == '-h' or o == '--help':
-        # We can't use vars () inside a function, as that only contains all 
-        # local variables and none of the global variables! Thus we have to 
+        # We can't use vars () inside a function, as that only contains all
+        # local variables and none of the global variables! Thus we have to
         # generate the help text here and pass it to the function...
         help (help_text % vars ())
     elif o == '-n' or o == '--name':
         name = a
     elif o == '-t' or o == '--title':
         title = a
+    elif o == '-a' or o == '--author':
+        author = a
     elif o == '-f' or o == '--fragment-options':
         fragment_options = a
     elif o == '--template':
@@ -87,11 +91,26 @@ for opt in options:
         raise Exception ('unknown option: ' + o)
 
 texi_file_re = re.compile ('.*\.i?te(ly|xi)$')
+html_file_re = re.compile ('.*\.i?htm(l)?$')
+xml_file_re = re.compile ('.*\.i?xml$')
+tex_file_re = re.compile ('.*\.i?(la)?tex$')
+pdf_file_re = re.compile ('.*\.i?pdf$')
 
 def name2line (n):
     if texi_file_re.match (n):
         # We have a texi include file, simply include it:
         s = r"@include %s" % os.path.basename (n)
+    elif (html_file_re.match (n) or pdf_file_re.match (n) or
+          xml_file_re.match (n) or tex_file_re.match (n)):
+        s = r"""
+@ifhtml
+@html
+<a href="%s">%s</a>
+<br/>
+@end html
+@end ifhtml
+""" % (os.path.basename (n), os.path.basename (n))
+        return s
     else:
         # Assume it's a lilypond file -> create image etc.
         s = r"""
@@ -107,7 +126,7 @@ def name2line (n):
 
 if files:
     dir = os.path.dirname (name) or "."
-# don't strip .tely extension, input/lsr uses .itely
+# don't strip .tely extension, Documentation/snippets uses .itely
     name = os.path.basename (name)
     template = template % vars ()