]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Patch by Arvid Grotting for minor keys and <<
[lilypond.git] / scripts / lilypond-book.py
index 5411f8bc3b1f2ef8af9c87775d5f297cdd01c770..44c08b5af988ba35568d299176bb4bf39d4c2643 100644 (file)
@@ -151,11 +151,11 @@ include_path = [os.getcwd ()]
 
 #lilypond_binary = 'valgrind --suppressions=/home/hanwen/usr/src/guile-1.6.supp  --num-callers=10 /home/hanwen/usr/src/lilypond/lily/out/lilypond'
 
-lilypond_binary = os.path.join ('@bindir@', 'lilypond')
+lilypond_binary = os.path.join ('@bindir@', 'lilypond-bin')
 
 # only use installed binary  when we're installed too.
 if '@bindir@' == ('@' + 'bindir@') or not os.path.exists (lilypond_binary):
-       lilypond_binary = 'lilypond'
+       lilypond_binary = 'lilypond-bin'
 
 
 
@@ -382,12 +382,10 @@ output_dict= {
 
        'latex': {
 
-               'output-lilypond-fragment' : r'''\begin[eps,singleline,%s]{lilypond}
-  \context Staff <
+               'output-lilypond-fragment' : r'''\begin[singleline,%s]{lilypond}
     \context Voice{
       %s
     }
-  >
 \end{lilypond}''',
                'output-filename' : r'''\verb+%s+:\\
 %% %s
@@ -405,7 +403,7 @@ output_dict= {
                'output-default-post': "\\def\postLilyPondExample{}\n",
                'output-default-pre': "\\def\preLilyPondExample{}\n",
                'usepackage-graphics': '\\usepackage{graphics}\n',
-               'output-eps': '\\noindent\\parbox{\\lilypondepswidth{%(fn)s.eps}}{\includegraphics{%(fn)s}}',
+               'output-eps': '\\noindent\includegraphics{%(fn)s}', 
                'output-noinline': r'''
 %% generated: %(fn)s.eps
 ''',
@@ -556,7 +554,7 @@ re_dict = {
        # why do we have distinction between @mbinclude and @include?
 
        'texi': {
-               'include':  '(?m)^[^%\n]*?(?P<match>@mbinclude[ \n\t]+(?P<filename>[^\t \n]*))',
+               'include':  '(?m)^[^%\n]*?(?P<match>@mbinclude\s+(?P<filename>\S*))',
                'input': no_match,
                'header': no_match,
                'preamble-end': no_match,
@@ -759,7 +757,7 @@ def scan_latex_preamble (chunks):
                if not m:
                        error ("Latex documents must start with a \documentclass command")
                if m.group (1):
-                       options = re.split (',[\n \t]*', m.group (1)[1:-1])
+                       options = re.split (r',\s*', m.group (1)[1:-1])
                else:
                        options = []
                if 'twocolumn' in options:
@@ -908,7 +906,10 @@ def make_lilypond_file (m):
                options = []
        (content, nm) = find_file (m.group ('filename'))
        options.append ("filename=%s" % nm)
-
+       (path, base) = os.path.split (nm)
+       
+       if path not in include_path:
+               include_path.append (path)
 
        return [('lilypond', content, options)]
        
@@ -1067,7 +1068,7 @@ def schedule_lilypond_block (chunk):
                                taken_file_names[basename] = 0
                        else:
                                taken_file_names[basename] = taken_file_names[basename] + 1
-                               basename = basename + "-%i" % taken_file_names[basename]
+                               basename = basename + "-t%i" % taken_file_names[basename]
        update_file (file_body, os.path.join (g_outdir, basename) + '.ly')
        needed_filetypes = ['tex']
 
@@ -1158,13 +1159,12 @@ def format_lilypond_block (chunk):
        if 'noinline' in opts:
                s = 'output-noinline'
        elif format == 'latex':
-               if 'eps' in opts:
+               if 'quote' in opts:
+                       s = 'output-latex-quoted'
+               elif 'eps' in opts:
                        s = 'output-eps'
                else:
-                       if 'quote' in opts:
-                               s = 'output-latex-quoted'
-                       else:
-                               s = 'output-latex-noquote'
+                       s = 'output-latex-noquote'
        elif format == 'texi':
                if 'quote' in opts:
                        s = 'output-texi-quoted'
@@ -1409,7 +1409,7 @@ def compile_all_files (chunks):
                cmd = '(( %s  >&2 ) >&- )' % cmd
                
                ly.system (cmd)
-               ly.system ("dvips -E -o %s.eps %s" % (file, file))
+               ly.system ("dvips -Ppdf -u+lilypond.map -E -o %s.eps %s" % (file, file))
        map (to_eps, eps)
 
        map (ly.make_ps_images, map (lambda x: x + '.eps', png))