]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/lilypond-book.itely:
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 24 Apr 2002 14:44:53 +0000 (14:44 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 24 Apr 2002 14:44:53 +0000 (14:44 +0000)
* scripts/lilypond-book.py: Add options [no]indent, linewidth and
noinline.

ChangeLog
Documentation/user/lilypond-book.itely
scripts/lilypond-book.py

index f42cd102de4dc73838449e01d2852bd9dadab07d..15159b6ee546ef35198f61e356cd71667735579f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2002-04-24  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * Documentation/user/lilypond-book.itely: 
+       * scripts/lilypond-book.py: Add options [no]indent, linewidth and
+       noinline.
+
        * input/mozart-hrn3-defs.ly (startGraceContext): Customize grace init.
 
        * scm/grob-property-description.scm (beam-space): Junk.
index 0250be706627023ea9241deaf9802bde2cd11a1a..d3ad0259dd5d394fc2b8d6cb678688b8ee9f307c 100644 (file)
@@ -173,8 +173,8 @@ smaller music font size (eg. 11 pt or 13 pt)
 @item intertext="@var{text}"
     Used in conjunction with @code{verbatim} option: this puts
 @var{text} between the code and the music.
-@item filename=@var{FILENAME}
-    Save the lilypond code to @var{FILENAME}. By default, a hash value
+@item filename="@var{filename}"
+    Save the lilypond code to @var{filename}. By default, a hash value
 of the code is used.
 
 @item @code{11pt}
@@ -216,10 +216,16 @@ of the code is used.
   Produce a single naturally spaced, unjustified line. (i.e.: linewidth = -1).
 @item multiline
   The opposite of @code{singleline}: justify and break lines.
+@item linewidth=@var{size}@var{unit}
+    Set linewidth to @var{size}, where @var{unit} = cm, mm, in or pt.
 @item fragment
 @item nofragment
     Override @command{lilypond-book} auto detection of what type of code is in the
     lilypond block, voice contents or complete code.
+@item indent=@var{size}@var{unit}
+    Set first line indent to @var{size}, where @var{unit} = cm, mm, in or pt.
+@item noindent
+    Set first line indent to zero.
 @item printfilename
     Prints the file name before the music example. Useful in conjunction
 with @code{\lilypondfile}.
index 7167d637b79c153344f81ad46ff3c9345421b21a..9c3d863adfad8908fe7d9270696efa8c02755a7d 100644 (file)
@@ -431,6 +431,9 @@ output_dict= {
                'output-default-pre': "\\def\preLilypondExample{}\n",
                'usepackage-graphics': '\\usepackage{graphics}\n',
                'output-eps': '\\noindent\\parbox{\\lilypondepswidth{%(fn)s.eps}}{\includegraphics{%(fn)s.eps}}',
+               'output-noinline': r'''
+%% generated: %(fn)s.eps
+''',
                'output-tex': '{\\preLilypondExample \\input %(fn)s.tex \\postLilypondExample\n}',
                'pagebreak': r'\pagebreak',
                },
@@ -445,6 +448,9 @@ output_dict= {
                  'output-lilypond-fragment': """@lilypond[%s]
 \context Staff\context Voice{ %s }
 @end lilypond """,
+                 'output-noinline': r'''
+@c generated: %(fn)s.png                 
+''',
                  'pagebreak': None,
                  'output-verbatim': r"""@example
 %s
@@ -590,6 +596,8 @@ def compose_full_body (body, opts):
        Add stuff to BODY using OPTS as options."""
        music_size = default_music_fontsize
        latex_size = default_text_fontsize
+       indent = ''
+       linewidth = ''
        for o in opts:
                if g_force_lilypond_fontsize:
                        music_size = g_force_lilypond_fontsize
@@ -601,6 +609,16 @@ def compose_full_body (body, opts):
                m = re.match ('latexfontsize=([0-9]+)pt', o)
                if m:
                        latex_size = string.atoi (m.group (1))
+                       
+               m = re.match ('indent=([-.0-9]+)(cm|in|mm|pt)', o)
+               if m:
+                       f = float (m.group (1))
+                       indent = 'indent = %f\\%s' % (f, m.group (2))
+                       
+               m = re.match ('linewidth=([-.0-9]+)(cm|in|mm|pt)', o)
+               if m:
+                       f = float (m.group (1))
+                       linewidth = 'linewidth = %f\\%s' % (f, m.group (2))
 
        if re.search ('\\\\score', body):
                is_fragment = 0
@@ -613,10 +631,15 @@ def compose_full_body (body, opts):
 
        if is_fragment and not 'multiline' in opts:
                opts.append('singleline')
+               
        if 'singleline' in opts:
-               l = -1.0;
-       else:
-               l = __main__.paperguru.get_linewidth()
+               linewidth = 'linewidth = -1.0'
+       elif not linewidth:
+               l = __main__.paperguru.get_linewidth ()
+               linewidth = 'linewidth = %f\pt' % l
+
+       if 'noindent' in opts:
+               indent = 'indent = 0.0\mm'
 
        for o in opts:
                m= re.search ('relative(.*)', o)
@@ -637,20 +660,23 @@ def compose_full_body (body, opts):
                        body = '\\relative %s { %s }' %(pitch, body)
        
        if is_fragment:
-               body = r"""\score { 
+               body = r'''\score { 
  \notes { %s }
   \paper { }  
-}""" % body
+}''' % body
 
        opts = uniq (opts)
        optstring = string.join (opts, ' ')
        optstring = re.sub ('\n', ' ', optstring)
-       body = r"""
+       body = r'''
 %% Generated automatically by: lilypond-book.py
 %% options are %s  
 \include "paper%d.ly"
-\paper  { linewidth = %f \pt } 
-""" % (optstring, music_size, l) + body
+\paper  {
+  %s
+  %s
+} 
+''' % (optstring, music_size, linewidth, indent) + body
 
        # ughUGH not original options
        return body
@@ -986,7 +1012,10 @@ def schedule_lilypond_block (chunk):
                m = re.search ('intertext="(.*?)"', o)
                if m:
                        newbody = newbody  + m.group (1) + "\n\n"
-       if format == 'latex':
+       
+       if 'noinline' in opts:
+               s = 'output-noinline'
+       elif format == 'latex':
                if 'eps' in opts:
                        s = 'output-eps'
                else: