11 return "$outdir/$outname$mudcount.ly";
16 return "$outdir/$outname$mudcount.tex";
23 print MUDELA "}\n \\paper { linewidth = -1.0\\cm; castingalgorithm = \\Wordwrap; } }\n";
27 print BOOK "\\end{verbatim}\n\\interexample";
32 if ( -f gen_mufile ) {
33 $status = system "diff -q $outdir/book-mudela.ly " . gen_mufile;
38 rename "$outdir/book-mudela.ly", gen_mufile;
42 if ( ! -f gen_texfile) {
43 system "lilypond ". gen_mufile;
44 rename "lelie.tex", gen_texfile;
46 print BOOK "\\preexample\\input " . gen_texfile . "\n\\postexample\n";
54 open MUDELA, ">$outdir/book-mudela.ly";
56 print BOOK "\\begin{verbatim}\n";
59 print MUDELA "\\score { \\melodic {";
67 return (/^\\begin{$s}/) ;
73 return (/^\\end{$s}/) ;
80 $verbatim_b =1 if ($s =~ /verbatim/ );
81 $fragment_b = 1 if ($s =~ /fragment/ );
86 print "usage: convert-mudela [options] [file]
89 --outdir=DIRECTORY write all files in directory DIRECTORY
90 --outname=NAME use NAME as base for the output
97 GetOptions( 'outdir=s', 'outname=s', 'help');
98 help if ( $opt_help ) ;
100 if (defined ($opt_outdir)) {
101 $outdir = $opt_outdir . "/";
106 if (defined ($ARGV[0])) {
111 if (defined ($opt_outname)) {
112 $outname = $opt_outname ;
114 die "Need to have an output name, use --outname" if ( $infile eq "-");
115 $outname = "$infile.tex";
118 my $openout ="$outdir$outname";
119 if ( $infile eq $openout ) {
120 die "The input can't be the output\n";
123 open INFILE, "<$infile";
124 open BOOK, ">$openout";
127 if (end_b "mudela") {
134 $s =~ s/\t/ /g; #shit
139 if (/^\\begin(\[.*\])?{mudela}/ ) {
141 $opts = $1 if ( defined ($1));
143 parse_mudela_opts($opts);