]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.81.tca1
authorTom Cato Amundsen <tca@gnu.org>
Sat, 2 Sep 2000 21:13:32 +0000 (23:13 +0200)
committerTom Cato Amundsen <tca@gnu.org>
Sat, 2 Sep 2000 21:13:32 +0000 (23:13 +0200)
1.3.80.tca1
===========
* Added Documentation/user/mb-latex.tex, mudela-book+latex example
  file and test case. Some work on Documentation/user/mudela-book.tely

* mudela-book.py: any combination of \verb, \begin{verbatim}
  @code and @example and mudela should work as expected.

* dropped [].extend that depend on python 1.5.2

---
Generated by tca@gnu.org,
From = lilypond-1.3.81, To = lilypond-1.3.81.tca1

usage

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.81.tca1.diff

Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure

CHANGES
Documentation/user/mudela-book.tely
VERSION
scripts/mudela-book.py

diff --git a/CHANGES b/CHANGES
index 4d150c249c387316223967ec2264d8fcbd4cadfe..c40a74600459e7a482d46a9fc1e6acdebd230c4d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,19 @@
-1.3.81.jcn1
+--- ../lilypond-1.3.81/CHANGES Mon Aug 28 11:59:46 2000
+++ b/CHANGES   Sat Sep  2 23:13:32 2000
+@@ -1,3 +1,13 @@
+1.3.80.tca1
+===========
+* Added Documentation/user/mb-latex.tex, mudela-book+latex example
+  file and test case. Some work on Documentation/user/mudela-book.tely
+
+* mudela-book.py: any combination of \verb, \begin{verbatim}
+  @code and @example and mudela should work as expected. 
+
+* dropped [].extend that depend on python 1.5.2 
+
+ 1.3.80.gp1
+ ==========
+ 1.3.81.jcn1
 ===========
 
 * Activated regex for windows.
index 6c7bdacef20468bb03c3f8429e862e5be3de4def..5eb5410c9dcb0aee362b5d193c6f15236090fee3 100644 (file)
@@ -1,8 +1,7 @@
 \input texinfo @c -*-texinfo-*-
 @setfilename mudela-book.info
 @settitle mudela-book Manual
-
-
+@afourpaper
 @titlepage
 @title mudela-book Manual
 @subtitle Integrating mudela with La@TeX{} and TeXinfo
@@ -68,16 +67,21 @@ except that this permission notice may be stated in a
 translation approved by the Free Software Foundation.
 
 @end ifinfo
+@tex
+\def\preMudelaExample{\vspace{0.5cm}}
+@end tex
 
-
+@contents
 @node Top, , , (dir)
 @top
 
 
+
 @section Introduction
 
-[TODO: THIS MANUAL IS OUTDATED. FIXME.]
+[TODO: THIS MANUAL IS NOT FINISHED YET. FIXME.]
 
+@ignore
 Mudela-book is a script that process your La@TeX{} file and with great
 help from GNU LilyPond it translates blocks of mudela code it finds
 inside @code{mudela} environments to tex or eps graphics. It then
@@ -88,252 +92,194 @@ Mudela-book will do its best to try to align the music to the left and
 right margins. Currently the most used papersizes and one- and
 twocolumn mode is supported, but if you use the geometry-package from
 La@TeX{} or change the margins things will break.
+@end ignore
+
+@file{mudela-book} is a script that helps integrating mudela and
+La@TeX{} or mudela and TeXinfo. mudela-book runs Lilypond on fragments
+of mudela in your source file, and includes the results into a
+document that can be processed with La@TeX{}, makeinfo or texi2dvi.
+The result is a text document with formatted music integrated.
 
 This document assumes you have basic knowledge of GNU LilyPond and
-La@TeX{}.
+La@TeX{} or texinfo.
 
-So what does this look like? Well, here is an example:
-@mudela[veryverbatim, intertext="produces this music:"]
+@ignore
+Mudela-book will do its best to try to align the music to the left and
+right margins. Currently the most used papersizes and twocolumn mode
+in La@TeX{} are supported. But if you change the margins, things will break.
+@end ignore
+
+@section Tutorial when using TeXinfo
+
+It is easies to learn by examples. A theme by Vagn Holmboe:
+
+@mudela[mbverbatim, intertext="will produce this music:"]
 \score{
   \notes\relative c'{
     \time 5/8;
     [e16( g b c a g][e a b d] | )e2 d,8 |
     [e16( g b c a g][e a b d] | )b2 [a16( f] |
     [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
-    [f( a b d b a][f a b d] | )e2
+    [f( a b d b a][f a b d] | )e2 [f16( e] | [f, a b d] )e4. |
+    [a,16 a a a a a][a a a a]
   }
 }
 @end mudela
-If you are lucky, the above example show a nice feature of LilyPond
-and La@TeX{}. Since LilyPond can output the music as @TeX{} graphics,
-La@TeX{} can insert pagebreaks between the lines of music.
-
-Notice that there is no @code{\paper} statement in the example
-above. Mudela-book will insert some code for you that defines the
-linewidth and the font to use. If you don't want to change the default, 
-there is no need to put an empty @code{\paper@{@}} inside the @code{\score}.
-In the example above, something like
-this might be inserted before your code:
+
+
+You can see that mudela code is put between the @code{@@mudela}
+and @code{@@end mudela} command. Mudela-book will insert some
+code before sending your mudela code to Lilypond, to make the
+music respect the margins. So the mudela code that was actually
+sendt to Lilypond, will be something like this (removed the
+music to save space):
+
 @example
 \include "paper16.ly"
-\paper@{ \paper_sixteen
-    linewidth = 390.\pt;
-    castingalgorithm = \Gourlay;
+\paper @{ linewidth = 455.00000 \pt; @}
+
+\score@{
+ YOUR MUDELA CODE
 @}
 @end example
-The actual values for linewidth will differ depending on papersize and
-number of columns. Also, if you use a different fontsize for the
-music, another file than @code{paper16.ly} will be included.
-
-If you want to make the music not so wide, you can insert a
-@code{\paper} statement that set the linewidth:
-
-@mudela[veryverbatim, intertext="produces this music:"]
-\score{
-  \notes\relative c'{
-    \time 5/8;
-    [e16( g b c a g][e a b d] | )e2 d,8 |
-    [e16( g b c a g][e a b d] | )b2 [a16( f] |
-    [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
-    [f( a b d b a][f a b d] | )e2
-  }
-  \paper{linewidth = 10.\cm;}
-}
-@end mudela
 
-Very often, if you mix music and text, the music is often only a 
-few notes or at most a few bars. This music should be as short as
-possible and not stretched to be aligned to the right margin.
+Compare the previous examples with this short block:
 
-If you only write voice-contents in the mudela block, mudela-book 
-will set the @code{linewidth} variable to -1, so Lilypond
-will make the music as short as possible but without breaking the
-line. Here is a well know harmonic progression:
-@mudela[veryverbatim, intertext="produce a well known harmonic progression:"]
-  <c' e g> <b d g> <c2 e g>
+@mudela[mbverbatim, intertext="that produces this music:"]
+c' d' e'
 @end mudela
 
-If you want to place music examples in the text,
-@mudela[eps]
-  <c' e g> <b d g> <c2 e g>
-@end mudela
-, you can use the @code{eps} option. This will create the music as
-eps graphics and include it into the document with the 
-@code{\includegraphics} command.
-
-The code used look like this:
+You can see that the mudela code is
+not complete, there are no @code{\score} keyword. This made
+mudela-book threat the content of the block a little different.
+This will be fed Lilypond:
 @example
-@@mudela[eps]
-  <c' e g> <b d g> <c2 e g>
-@@end mudela
+\include "paper16.ly"
+\paper @{ linewidth = -1.00000 \pt; @}
+\score @{
+  \notes @{
+ YOUR MUDELA CODE
+ @}
+  \paper@{ @}
+@}
 @end example
 
-You can also use the @code{eps} option if the block is a complete
-mudela source. This 5 cm long empty line, 
-@mudela[eps]
+@code{linewidth = -1.00000 \pt;} tell Lilypond not to break
+the music. If you enter too much music, the music will go
+beyond the right margin.
+
+You can set the linewidth yourself:
+
+@mudela[mbverbatim, intertext="produces this music:"]
 \score{
 \notes{s}
 \paper{ linewidth = 5.\cm;}
\notes\relative c'{c d e f | g a b c | c b a g | f e d c}
\paper { indent = 0.0 \cm; linewidth = 4.0 \cm; }
 }
 @end mudela
-was created with this code:
+
+There is also a short version of the @code{@@mudela} command.
+The code
+@example 
+@@mudela@{ YOUR MUDELA CODE @}
+@end example
+
+is short for
+
 @example
-@@mudela[eps]
-\score@{
-  \notes@{s@}
-  \paper@{ linewidth = 5.\cm;@}
-@}
+@@mudela
+\context Staff \context Voice @{ YOUR MUDELA CODE @}
 @@end mudela
 @end example
 
-To avoid that La@TeX{} places the music on a line of its one, there should
-be no empty lines between the normal text and the mudela
-environment. 
-
-You can also use @code{mudelafile} (on a separate line, FIXME), to
-include another file.
 
-@section Fontsize options You can use all lilypond fontsizes in
-mudela-book.  The default 16pt fontsize is probably to big to be
-included in the middle of the text, 11pt or 13pt is probably better.
+@section TeXinfo reference
 
-The code can look like this:
+Your code should look something like this:
 @example
-@@mudela[13pt, eps]
-<c' e g>
+@@mudela[options, go, here]
+ YOUR MUDELA CODE
 @@end mudela
 @end example
 
-The following options set the fontsize:
-@itemize
-@item @code{11pt}
-@mudela[11pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
-@end mudela
-@item @code{13pt}
-@mudela[13pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
-@end mudela
-@item @code{16pt}
-@mudela[16pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
-@end mudela
-@item @code{20pt}
-@mudela[20pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
-@end mudela
-@item @code{26pt}
-@mudela[26pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
-@end mudela
-@end itemize
+or
 
+@example
+@@mudela[option, go, here]@{ YOUR MUDELA CODE @}
+@end example
 
-@section More options
-@itemize
-@item The @code{singleline} option set @code{linewidth} to -1.0.
-@item The @code{multiline} option set @code{linewidth} to a value letting
-the music be aligned to the right margin. The music can span several
-lines. 
+Mudelabook knows the default margins, and this papersizes:
+@itemize @bullet
+@item @code{@@afourpaper}
+@item @code{@@afourwide}
+@item @code{@@smallbook}
 @end itemize
+@code{@@pagesizes} are not supported.
 
-@section Just in case...
-The options @code{fragment} and @code{nonfragment} will override
-mudela-book when it scans the mudela code to see if it is voice
-contents or complete code. This might be useful if mudela-book choose
-wrong. 
-
-Since there is no finder's fee which doubles every year, there is no
-need to wait for the price money to grow. So send a bug report today
-if you need this one of these options.
-
-@section Examples
 
-This was all options to @code{\begin}. The rest of the mudela
-document will show some ways you can use mudela in
-La@TeX{} documents. It will also act as a simple test-suite for
-mudela-book. You can place @code{eps} mudela in and marginspars just
-as any other included eps graphics.
-
-@mudela
-\score{
-  \notes\relative c'{ 
-        \time 12/8;  
-        r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
-        [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
-        
-        r4.-\fermata [cis,16 cis g'8 f16 f b8][g16 g f8 b16 b] dis4.-\fermata
-  }
-  \paper{linewidth = 7.\cm;}
-}
-@end mudela
+@section La@TeX{} reference
 
+@example
+\begin[option, go, here]@{mudela@}
+ YOUR MUDELA CODE
+\end@{mudela@}
+@end example
 
-To the right you can see some bars from the trumpet fanfara from the
-beginning of the fantastic street opera ``Houdini the Great'', by the
-Danish composer Andy Pape. The music is put inside a
-@code{floatingfigure} environment, and the music will be aligned by
-the right marging if you set floatingfigure width and mudela linewidth
-to the same value. The code looks like this:
+@example
+\mudela@{ YOUR MUDELA CODE @}
+@end example
 
-@mudela[verbatim]
-\score{
-  \notes\relative c'{ 
-    \time 12/8;  
-    r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
-    [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
-        
-    r4.-\fermata [cis,16 cis g'8 f16 f b8]
-    [g16 g f8 b16 b] dis4.-\fermata
-  }
-  \paper{linewidth = 7.\cm;}
-}
-@end mudela
+The 'geometry' package is is not supported. The most popular
+papersizes should work.
 
-If you have a lot of small music examples like this in the middle of
-your text, you might get a nicer look by using ``double'' line
-spacing. Put the @code{\linespread@{1.6@}} command into the preamble of
-your document. Then the line spacing will not be increased between the
-lines where you have music printed with the smallest font size.
+Mudela-book know about the @code{\onecolumn} and 
+@code{\twocolumn} commands.
 
-Mudela-book does know about @code{\onecolumn} and @code{\twocolumn}. 
-So the music will be adjusted to the new linewith:
+@section Options
 
-Verbatim environments will also ignore the page margins. That is
-a feature of La@TeX{}. (But you usually put things inside a verbatim
-environment when you don't want La@TeX{} to do any linebreaking)
+@table @samp
+@item eps
+    the music is created as eps graphics that can be inserted in 
+    the middle of a text line, not only as a separate paragraph.
+    (La@TeX{} only)
+@item verbatim
+    CONTENTS is copied into the TeX source enclosed in a verbatim block.
+@item 11pt, 13pt, 16pt, 20pt, 26pt
+    set the fontsize to use for the music
+@item singleline
+  linewidth = -1.
+@item multiline
+  linewidth = textwidth
+@item fragment
+@item nonfragment
+    Override mudela-book autodetection of what type of code is in the
+    mudela block, voice contents or complete code.
+@end table
 
 
 @section Texinfo behavior
-
 [TODO]
 
 @section Invocation
-
 @file{mudela-book} is a script that helps integrating mudela and
 La@TeX{}.  mudela-book runs LilyPond on fragments of mudela in your
 source file, and includes the results into document that can be
 processed with La@TeX{}.  The result is a text document with formatted
 music integrated.
 
-Lilypond will by default create all output files in directory @file{out}.
-The file to give to latex has ext @file{.latex}.
+@example
+mudela-book -M --outdir=out inputfile.tely
+@end example
+will create @code{out/inputfile.texi}, depencencies in
+@code{out/inputfile.dep} and lots of other files in @code{out/}
+
+If you are processing a latex file, the file to give to
+latex has ext @file{.latex}
 
+If you are processing a texinfo file, you can use the
+@code{--no-pictures} command line optino if you are not going
+to create html output.
+
+@ignore
 @strong{About the input}
 
 If the file contains the ``block''
@@ -353,48 +299,48 @@ defined to nothing by default, and the user can redefine them
 to whatever he wants.
 
 @code{\begin} takes the following options:
+@end ignore
 
-@table @samp
-@item eps
-    the music is created as eps graphics that can be inserted in 
-    the middle of a text line, not only as a separate paragraph
-@item verbatim
-    CONTENTS is copied into the TeX source enclosed in a verbatim block.
-@item 11pt, 13pt, 16pt, 20pt, 26pt
-    set the fontsize to use for the music
-@item singleline
-  linewidth = -1.
-@item multiline
-  linewidth = textwidth
-@item fragment
-@item nonfragment
-    Override mudela-book autodetection of what type of code is in the
-    mudela block, voice contents or complete code.
-@end table
 
+@subsection Command line options
 
 @table @samp
 
-@item --default-mudela-fontsize=??pt
+@item -f, --format=
+    Specify the document type to process, @code{latex} or @code{texi}.
+    @file{mudela-book} usually figure out this automatically.
+@item --default-music-fontsize=??pt
     Set the fontsize to use for mudela if no fontsize is given
     as option.
-@item --force-mudela-fontsize=??pt
+@item --force-music-fontsize=??pt
     Force all mudela to use this fontsize, overriding options
     given to \begin@{mudela@}
+@item -I DIR, --include=DIR
+    include path
+@item -M, --dependencies
+        Write dependencies to out-www/filename.dep
+@item --dep-prefix=PREF
+       prepend PREF before each -M dependency
+@item -n, --no-lily
+       don't run lilypond
+@item --no-pictures
+       don't generate pictures
+@item --read-lys
+       don't write ly files. This way you can do
+       @example
+       mudela-book file.tely
+       convert-mudela
+       mudela-book --read-lys
+       @end example
 @item --outname=FILE
     The name of La@TeX{} file to output. If this option  is not given,
-the output name derived from the input name.
-@item --out-www=DIRECTORY
-    The name of the directory to output lilypond output and input to.
-    This must be a name; the subdirectory will be created in the cwd. [FIXME]
+    the output name derived from the input name.
+@item --outdir=
+       where to place generated files
+@item --version
+       print version information
 @item --help
        Print a short help message
-@item --dependencies
-        Write dependencies to out-www/filename.dep
-@item --force-verbatim
-       Make all mudela verbatim.
-@item --initfile=FILE
-        read command definitions from @file{FILE}
 @end table
 
 
@@ -410,12 +356,16 @@ The La@TeX{} \includeonly@{...@} command is ignored.
 
 Ignores almost all La@TeX{} commands that changes margins and linewidths.
 
+La@TeX{} comments can confuse mudela-book:
+@example
+% this music will be displayed: \mudela@{c d e@}
+@end example
+
 @section Authors
 
 @email{hanwen@@cs.uu.nl, Han-Wen Nienhuys}, @uref{http://www.cs.uu.nl/people/hanwen}
 
-@email{tomato@@xoommail.com, Tom Cato Amundsen}
-
+@email{tca@@gnu.org, Tom Cato Amundsen}
 
 @bye
 
diff --git a/VERSION b/VERSION
index ab1fe483c53418d92b8f5bfb3c2ad4e1294d182e..a3a3c8c7a9230453b982747c025fb9bfdb20f74b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=81
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=tca1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 71542b2e39954eb401e5d8fe08da33afd781f5c5..03b479bfb260c54ada2d9fb9b76e7e30c916004d 100644 (file)
@@ -1,43 +1,7 @@
 #!@PYTHON@
 # vim: set noexpandtab:
-import time
-t1 = time.clock()
-
-# support bruk av convert-mudela
-#
-# option:
-# 11pt, 13pt, 16pt, 20pt, 26pt
-# singleline
-# multiline
-# fragment  (used when a comment containg \score confuses mudela-book)
-# nonfragment (probably not needed)
-# verbatim
-
-# latex only options:
-# eps
-# 
-
-# command line options
-# --defalt-mudela-fontsize
-# --force-mudela-fontsize
-# --outname
-# --force-verbatim make all mudela verbatim. Maybe not that useful
-# --dependencies
-# --dep-prefix
-# --no-pictures
-# --no-lily
 # TODO: Figure out clean set of options.
-
-# BUG: does not handle \verb|\begin{verbatim}\end{verbatim}| correctly.
-# Should make a joint RE for \verb and \begin, \end{verbatim}
-
-# TODO: add an option to read the .ly files from a previous run and dump
-# the .tex file, so you can do
-#
-# * mudela-book file.tex
-# * convert-mudela *.ly
-# * mudela-book --read-lys *.ly
-#
+# add support for .lilyrc
 
 import os
 import stat
@@ -48,8 +12,7 @@ import sys
 import __main__
 
 
-initfile = ''
-program_version = '1.3.69-very-unstable'
+program_version = '@TOPLEVEL_VERSION@'
 
 include_path = [os.getcwd()]
 
@@ -61,7 +24,6 @@ g_do_pictures = 1
 g_num_cols = 1
 format = ''
 g_run_lilypond = 1
-g_use_hash = 1
 no_match = 'a\ba'
 
 default_music_fontsize = 16
@@ -100,22 +62,20 @@ def get_linewidth(cols, paper, fontsize):
 
 option_definitions = [
   ('EXT', 'f', 'format', 'set format.  EXT is one of texi and latex.'),
-  ('DIM',  '', 'default-music-fontsize', 'default fontsize for music.  DIM is assumed to in points'),
+  ('DIM',  '', 'default-music-fontsize', 'default fontsize for music.  DIM is assumed to be in points'),
   ('DIM',  '', 'default-mudela-fontsize', 'deprecated, use --default-music-fontsize'),
-  ('', 'h', 'help', 'print help'),
-  ('DIR', 'I', 'include', 'include path'),
-  ('', '', 'init', 'mudela-book initfile'),
-  ('DIM', '', 'force-music-fontsize', 'force fontsize for all inline mudela. DIM is assumed to in points'),
+  ('DIM', '', 'force-music-fontsize', 'force fontsize for all inline mudela. DIM is assumed be to in points'),
   ('DIM', '', 'force-mudela-fontsize', 'deprecated, use --force-music-fontsize'),
-  ('', '', 'force-verbatim', 'make all mudela verbatim'),
+  ('DIR', 'I', 'include', 'include path'),
   ('', 'M', 'dependencies', 'write dependencies'),
+  ('PREF', '',  'dep-prefix', 'prepend PREF before each -M dependency'),
   ('', 'n', 'no-lily', 'don\'t run lilypond'),
   ('', '', 'no-pictures', "don\'t generate pictures"),
   ('', '', 'read-lys', "don't write ly files."),
-  ('FILE', 'o', 'outname', 'prefix for filenames'),
-  ('', 'v', 'version', 'print version information' ),
-  ('PREF', '',  'dep-prefix', 'prepend PREF before each -M dependency'),
+  ('FILE', 'o', 'outname', 'filename main output file'),
   ('FILE', '', 'outdir', "where to place generated files"),
+  ('', 'v', 'version', 'print version information' ),
+  ('', 'h', 'help', 'print help'),
   ]
 
 # format specific strings, ie. regex-es for input, and % strings for output
@@ -190,16 +150,16 @@ re_dict = {
                  'option-sep' : ', *',
                  'header': r"""\\documentclass(\[.*?\])?""",
                  'preamble-end': '\\\\begin{document}',
-                 'verbatim': r"""(?s)\\begin{verbatim}(?P<code>.*?)\\end{verbatim}""",
-                 'verb': r"""\\verb(.)(?P<code>.*?)\1""",
+                 'verbatim': r"""(?s)(?P<code>\\begin{verbatim}.*?\\end{verbatim})""",
+                 'verb': r"""(?P<code>\\verb(?P<del>.).*?(?P=del))""",
                  'mudela-file': r'\\mudelafile(\[(?P<options>.*?)\])?\{(?P<filename>.+)}',
-                 'mudela' : '\\\\mudela(\[(?P<options>.*?)\])?{(?P<code>.*?)}',
+                 'mudela' : '(?m)\\\\mudela(\[(?P<options>.*?)\])?{(?P<code>.*?)}',
+                 #'mudela-block': r"""(?m)^[^%]*?\\begin(\[(?P<options>.*?)\])?{mudela}(?P<code>.*?)\\end{mudela}""",
                  'mudela-block': r"""(?s)\\begin(\[(?P<options>.*?)\])?{mudela}(?P<code>.*?)\\end{mudela}""",
-                 'interesting-cs': '\\\\(chapter|section|twocolumn|onecolumn)',
                  'def-post-re': r"""\\def\\postMudelaExample""",
                  'def-pre-re': r"""\\def\\preMudelaExample""",           
                  'intertext': r',?\s*intertext=\".*?\"',
-                 'ignore': no_match,
+                 'ignore': r"(?m)(?P<code>%.*?^)",
                  'numcols': r"(?P<code>\\(?P<num>one|two)column)",
                  },
        
@@ -209,14 +169,13 @@ re_dict = {
                 'header': no_match,
                 'preamble-end': no_match,
                 'verbatim': r"""(?s)(?P<code>@example\s.*?@end example\s)""",
-                'verb': r"""@code{(?P<code>.*?)}""",
+                'verb': r"""(?P<code>@code{.*?})""",
                 'mudela-file': '@mudelafile(\[(?P<options>.*?)\])?{(?P<filename>[^}]+)}',
                 'mudela' : '@mudela(\[(?P<options>.*?)\])?{(?P<code>.*?)}',
                 'mudela-block': r"""(?s)@mudela(\[(?P<options>.*?)\])?\s(?P<code>.*?)@end mudela\s""",
-                'interesting-cs': r"""[\\@](chapter|section)""",
                  'option-sep' : ', *',
                  'intertext': r',?\s*intertext=\".*?\"',
-                 'ignore': r"(?s)@ignore\s(.*?)@end ignore\s",
+                 'ignore': r"(?s)(?P<code>@ignore\s.*?@end ignore)\s",
                  'numcols': no_match,
                 }
        }
@@ -392,7 +351,7 @@ def find_file (name):
                return ''
 
 def do_ignore(match_object):
-       return []
+       return [('ignore', match_object.group('code'))]
 
 def make_verbatim(match_object):
        return [('verbatim', match_object.group('code'))]
@@ -464,7 +423,9 @@ def chop_chunks(chunks, re_name, func):
                     str = ''
                 else:
                     newchunks.append (('input', str[:m.start (0)]))
-                    newchunks.extend(func(m))
+                    #newchunks.extend(func(m))
+                   # python 1.5 compatible:
+                   newchunks = newchunks + func(m)
                     str = str [m.end(0):]
         else:
             newchunks.append(c)
@@ -489,7 +450,6 @@ def read_doc_file (filename):
        # we have to check for verbatim before doing include,
        # because we don't want to include files that are mentioned
        # inside a verbatim environment
-       chunks = chop_chunks(chunks, 'ignore', do_ignore)
        chunks = chop_chunks(chunks, 'verbatim', make_verbatim)
        chunks = chop_chunks(chunks, 'verb', make_verb)
        #ugh fix input
@@ -498,25 +458,8 @@ def read_doc_file (filename):
        return chunks
 
 
-def advance_counters (counter, str):
-       """Advance chap/sect counters,
-       Return the new counter tuple
-       """
-       (chapter, section, count) = counter
-       while str:
-               m = get_re ('interesting-cs').search(str)
-               if not m:
-                       break
-               str = str[m.end(0):]
-               g = m.group (1)
-               if g == 'chapter':#ugh use dict
-                       (chapter, section, count)  = (chapter + 1, 0, 0)
-               elif g == 'section':
-                       (section, count)  = (section + 1, 0)
-       return (chapter, section, count)
-
-taken_file_names = []
-def schedule_mudela_block (basename, chunk, extra_opts):
+taken_file_names = {}
+def schedule_mudela_block (chunk, extra_opts):
        """Take the body and options from CHUNK, figure out how the
        real .ly should look, and what should be left MAIN_STR (meant
        for the main file).  The .ly is written, and scheduled in
@@ -535,15 +478,16 @@ def schedule_mudela_block (basename, chunk, extra_opts):
        assert type == 'mudela'
        opts = opts +  extra_opts
        file_body = compose_full_body (body, opts)
-       if __main__.g_use_hash:
-               basename = `abs(hash (file_body))`
+       basename = `abs(hash (file_body))`
        for o in opts:
                m = re.search ('filename="(.*?)"', o)
                if m:
-                       basename = m.group (1)#ugh add check if more than
-                       #one file has the same name
-                       assert basename not in taken_file_names
-                       taken_file_names.append(basename)
+                       basename = m.group (1)
+                       if not taken_file_names.has_key(basename):
+                           taken_file_names[basename] = 0
+                       else:
+                           taken_file_names[basename] = taken_file_names[basename] + 1
+                           basename = basename + "-%i" % taken_file_names[basename]
        # writes the file if necessary, returns true if it was written
        if not g_read_lys:
                update_file(file_body, os.path.join(g_outdir, basename) + '.ly')
@@ -583,16 +527,11 @@ def schedule_mudela_block (basename, chunk, extra_opts):
        return ('mudela', newbody, opts, todo, basename)
 
 def process_mudela_blocks(outname, chunks, global_options):#ugh rename
-       (chap,sect,count) = (0,0,0)
        newchunks = []
        # Count sections/chapters.
        for c in chunks:
-               if c[0] == 'input':
-                       (chap,sect,count) = advance_counters((chap,sect,count), c[1])
-               elif c[0] == 'mudela':
-                       base = '%s-%d.%d.%d' % (outname, chap, sect, count)
-                       count = count + 1
-                       c = schedule_mudela_block (base, c, global_options)
+               if c[0] == 'mudela':
+                       c = schedule_mudela_block (c, global_options)
                elif c[0] == 'numcols':
                        __main__.g_num_cols = c[2]
                newchunks.append (c)
@@ -777,8 +716,9 @@ def do_file(input_filename):
        chunks = chop_chunks(chunks, 'mudela', make_mudela)
        chunks = chop_chunks(chunks, 'mudela-file', make_mudela_file)
        chunks = chop_chunks(chunks, 'mudela-block', make_mudela_block)
-       chunks = chop_chunks(chunks, 'numcols', do_columns)
        #for c in chunks: print c, "\n"
+       chunks = chop_chunks(chunks, 'ignore', do_ignore)
+       chunks = chop_chunks(chunks, 'numcols', do_columns)
        global_options = scan_preamble(chunks[0][1])
        chunks = process_mudela_blocks(my_outname, chunks, global_options)
        # Do It.
@@ -801,8 +741,7 @@ def do_file(input_filename):
        sys.stderr.write ("Writing `%s'\n" % foutn)
        fout = open (foutn, 'w')
        for c in chunks:
-               #if c[1] is not None:
-                       fout.write (c[1])
+               fout.write (c[1])
        fout.close ()
 
        if do_deps:
@@ -824,11 +763,10 @@ for opt in options:
 
        if o == '--include' or o == '-I':
                include_path.append (a)
-       elif o == '--version':
+       elif o == '--version' or o == '-v':
                print_version ()
                sys.exit  (0)
-
-       elif o == '--format' or o == '-o':
+       elif o == '--format' or o == '-f':
                __main__.format = a
        elif o == '--outname' or o == '-o':
                if len(files) > 1:
@@ -840,7 +778,7 @@ for opt in options:
                help ()
        elif o == '--no-lily' or o == '-n':
                __main__.g_run_lilypond = 0
-       elif o == '--dependencies':
+       elif o == '--dependencies' or o == '-M':
                do_deps = 1
        elif o == '--default-music-fontsize':
                default_music_fontsize = string.atoi (a)
@@ -852,9 +790,6 @@ for opt in options:
        elif o == '--force-mudela-fontsize':
                print "--force-mudela-fontsize is deprecated, use --default-mudela-fontsize"
                g_force_mudela_fontsize = string.atoi(a)
-
-       elif o == '--init':
-               initfile =  a
        elif o == '--dep-prefix':
                g_dep_prefix = a
        elif o == '--no-pictures':
@@ -873,10 +808,6 @@ if g_outdir:
 for input_filename in files:
        do_file(input_filename)
        
-
-
-t2 = time.clock()
-print "Time:", t2-t1
 #
 # Petr, ik zou willen dat ik iets zinvoller deed,
 # maar wat ik kan ik doen, het verandert toch niets?