10 return "$outdir/$outname$mudcount.ly";
15 return "$outdir/$outname$mudcount.tex";
22 print MUDELA "}\n \\paper { linewidth = -1.0\\cm; castingalgorithm = \\Wordwrap; } }\n";
26 print BOOK "\\end{verbatim}\n\\interexample";
31 if ( -f gen_mufile ) {
32 $status = system "diff -q $outdir/book-mudela.ly " . gen_mufile;
37 rename "$outdir/book-mudela.ly", gen_mufile;
41 if ( ! -f gen_texfile) {
42 system "lilypond ". gen_mufile;
43 rename "lelie.tex", gen_texfile;
45 print BOOK "\\preexample\\input " . gen_texfile . "\n\\postexample\n";
53 open MUDELA, ">$outdir/book-mudela.ly";
55 print BOOK "\\begin{verbatim}\n";
58 print MUDELA "\\score { \\melodic {";
66 return (/^\\begin{$s}/) ;
72 return (/^\\end{$s}/) ;
79 $verbatim_b =1 if ($s =~ /verbatim/ );
80 $fragment_b = 1 if ($s =~ /fragment/ );
85 print "usage: convert-mudela [options] [file]
88 --outdir=DIRECTORY write all files in directory DIRECTORY
89 --outname=NAME use NAME as base for the output
96 GetOptions( 'outdir=s', 'outname=s', 'help');
97 help if ( $opt_help ) ;
99 if (defined ($opt_outdir)) {
100 $outdir = $opt_outdir . "/";
105 if (defined ($ARGV[0])) {
110 if (defined ($opt_outname)) {
111 $outname = $opt_outname ;
113 die "Need to have an output name, use --outname" if ( $infile == "-");
114 $outname = "$infile.tex";
117 open INFILE, "<$infile";
118 open BOOK, ">$outdir$outname";
121 if (end_b "mudela") {
128 $s =~ s/\t/ /g; #shit
133 if (/^\\begin(\[.*\])?{mudela}/ ) {
135 $opts = $1 if ( defined ($1));
137 parse_mudela_opts($opts);