From: John Mandereau Date: Wed, 2 Jan 2008 15:51:14 +0000 (+0100) Subject: Add LSR tags and improve LSR snippets presentation X-Git-Tag: release/2.11.38-1~135^2~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=95c0da566d72ce0823a3f6ff0c1cf35e4b7433b3;p=lilypond.git Add LSR tags and improve LSR snippets presentation - add tags: contexts-and-engravers, tweaks-and-overrides, paper-and-layout, breaks, spacing, midi, titles, - add verbatim lilypond-book option for lilypond-snippets, - improve snippets Texinfo document formatting. --- diff --git a/buildscripts/lys-to-tely.py b/buildscripts/lys-to-tely.py index a9186627d8..c026522434 100644 --- a/buildscripts/lys-to-tely.py +++ b/buildscripts/lys-to-tely.py @@ -14,25 +14,29 @@ import os import getopt program_name = 'lys-to-tely' + include_snippets = '@lysnippets' +fragment_options = 'printfilename,texidoc' def help (): sys.stdout.write (r"""Usage: %(program_name)s [OPTIONS]... LY-FILE... Construct tely doc from LY-FILEs. Options: - -h, --help print this help - -o, --output=NAME write tely doc to NAME - -t, --title=TITLE set tely doc title TITLE - --template=TEMPLATE use TEMPLATE as Texinfo template file, + -h, --help print this help + -f, --fragment-options=OPTIONS use OPTIONS as lilypond-book fragment + options + -o, --output=NAME write tely doc to NAME + -t, --title=TITLE set tely doc title TITLE + --template=TEMPLATE use TEMPLATE as Texinfo template file, instead of standard template; TEMPLATE should contain a command - '%(include_snippets)s' to tell where to insert LY-FILEs. When this option - is used, NAME and TITLE are ignored + '%(include_snippets)s' to tell where to insert LY-FILEs. When this + option is used, NAME and TITLE are ignored. """ % vars ()) sys.exit (0) -(options, files) = getopt.getopt (sys.argv[1:], 'hn:t:', - ['help', 'name=', 'title=', 'template=']) +(options, files) = getopt.getopt (sys.argv[1:], 'f:hn:t:', + ['fragment-options=', 'help', 'name=', 'title=', 'template=']) name = "ly-doc" title = "Ly Doc" @@ -69,10 +73,12 @@ for opt in options: name = a elif o == '-t' or o == '--title': title = a + elif o == '-f' or o == '--fragment-options': + fragment_options = a elif o == '--template': template = open (a, 'r').read () else: - raise 'unknown opt ', o + raise Exception ('unknown option: ' + o) def name2line (n): # UGR @@ -83,7 +89,7 @@ def name2line (n): @end html @end ifhtml -@lilypondfile[printfilename,texidoc]{%s}""" % (n, n) +@lilypondfile[%s]{%s}""" % (n, fragment_options, n) return s if files: diff --git a/buildscripts/makelsr.py b/buildscripts/makelsr.py index c4f512ae51..69fac25f0c 100755 --- a/buildscripts/makelsr.py +++ b/buildscripts/makelsr.py @@ -3,6 +3,7 @@ import sys import os import glob +import re USAGE = ''' Usage: makelsr.py LSR_SNIPPETS_DIR This script must be run from top of the source tree; @@ -24,7 +25,9 @@ TAGS.extend (['pitches', 'rhythms', 'expressive-marks', TAGS.extend (['vocal-music', 'chords', 'piano-music', 'percussion', 'guitar', 'strings', 'bagpipes', 'ancient-notation']) -TAGS.append ('other') +# other +TAGS.extend (['contexts-and-engravers', 'tweaks-and-overrides', 'paper-and-layout', 'breaks', +'spacing', 'midi', 'titles', 'other']) def exit_with_usage (n=0): sys.stderr.write (USAGE) @@ -41,13 +44,19 @@ if not (os.path.isdir (DEST) and os.path.isdir (NEW_LYS)): unsafe = [] unconverted = [] +# mark the section that will be printed verbatim by lilypond-book +end_header_re = re.compile ('(\\header {.*?}\n)\n', re.M | re.S) + +def mark_verbatim_section (ly_code): + return end_header_re.sub ('\\1% begin verbatim\n', ly_code) + def copy_ly (srcdir, name, tags): global unsafe global unconverted dest = os.path.join (DEST, name) f = open (dest, 'w') f.write (LY_HEADER % ', '.join (tags)) - f.write (open (os.path.join (srcdir, name)).read ()) + f.write (mark_verbatim_section (open (os.path.join (srcdir, name)).read ())) f.close () e = os.system('convert-ly -e ' + dest) if e: diff --git a/input/lsr/GNUmakefile b/input/lsr/GNUmakefile index 6092e6058a..df45b73222 100644 --- a/input/lsr/GNUmakefile +++ b/input/lsr/GNUmakefile @@ -12,7 +12,7 @@ IN_ITELY_FILES = $(call src-wildcard,*-intro.itely) GENERATED_ITELY_FILES = $(IN_ITELY_FILES:%-intro.itely=$(outdir)/%.itely) $(outdir)/%.itely: %-intro.itely %.snippet-list - xargs $(PYTHON) $(buildscript-dir)/lys-to-tely.py --name=$@ --template=$< < $*.snippet-list + xargs $(PYTHON) $(buildscript-dir)/lys-to-tely.py -f printfilename,texidoc,verbatim --name=$@ --template=$< < $*.snippet-list $(outdir)/snippets.texi: snippets.tely $(GENERATED_ITELY_FILES) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) $< diff --git a/input/lsr/ancient-notation-intro.itely b/input/lsr/ancient-notation-intro.itely index 52a221029e..4f6d24012e 100644 --- a/input/lsr/ancient-notation-intro.itely +++ b/input/lsr/ancient-notation-intro.itely @@ -1,5 +1,5 @@ @node Ancient notation -@unnumbered Ancient notation +@unnumberedsec Ancient notation @lysnippets diff --git a/input/lsr/bagpipes-intro.itely b/input/lsr/bagpipes-intro.itely index 64b7a08658..67b897e84f 100644 --- a/input/lsr/bagpipes-intro.itely +++ b/input/lsr/bagpipes-intro.itely @@ -1,5 +1,5 @@ @node Bagpipes -@unnumbered Bagpipes +@unnumberedsec Bagpipes @lysnippets diff --git a/input/lsr/chords-intro.itely b/input/lsr/chords-intro.itely index c9980477ef..537014c3cb 100644 --- a/input/lsr/chords-intro.itely +++ b/input/lsr/chords-intro.itely @@ -1,5 +1,5 @@ @node Chords -@unnumbered Chords +@unnumberedsec Chords @lysnippets diff --git a/input/lsr/contexts-and-engravers-intro.itely b/input/lsr/contexts-and-engravers-intro.itely new file mode 100644 index 0000000000..c4f8a81849 --- /dev/null +++ b/input/lsr/contexts-and-engravers-intro.itely @@ -0,0 +1,5 @@ +@node Contexts and engravers +@unnumberedsec Contexts and engravers + +@lysnippets + diff --git a/input/lsr/editorial-and-educational-use-intro.itely b/input/lsr/editorial-and-educational-use-intro.itely index d014a36d8a..83188738bb 100644 --- a/input/lsr/editorial-and-educational-use-intro.itely +++ b/input/lsr/editorial-and-educational-use-intro.itely @@ -1,5 +1,5 @@ @node Editorial and educational use -@unnumbered Editorial and educational use +@unnumberedsec Editorial and educational use @lysnippets diff --git a/input/lsr/expressive-marks-intro.itely b/input/lsr/expressive-marks-intro.itely index 6b6550dd36..340e428b3a 100644 --- a/input/lsr/expressive-marks-intro.itely +++ b/input/lsr/expressive-marks-intro.itely @@ -1,5 +1,5 @@ @node Expressive marks -@unnumbered Expressive marks +@unnumberedsec Expressive marks @lysnippets diff --git a/input/lsr/guitar-intro.itely b/input/lsr/guitar-intro.itely index 931ad7a54e..2cfb2517ce 100644 --- a/input/lsr/guitar-intro.itely +++ b/input/lsr/guitar-intro.itely @@ -1,5 +1,5 @@ @node Guitar -@unnumbered Guitar +@unnumberedsec Guitar @lysnippets diff --git a/input/lsr/midi-intro.itely b/input/lsr/midi-intro.itely new file mode 100644 index 0000000000..5f9f4f9b92 --- /dev/null +++ b/input/lsr/midi-intro.itely @@ -0,0 +1,5 @@ +@node MIDI +@unnumberedsec MIDI + +@lysnippets + diff --git a/input/lsr/other-intro.itely b/input/lsr/other-intro.itely index 795a15b8e3..f09196f04a 100644 --- a/input/lsr/other-intro.itely +++ b/input/lsr/other-intro.itely @@ -1,5 +1,5 @@ @node Other -@unnumbered Other +@unnumberedsec Other @lysnippets diff --git a/input/lsr/paper-and-layout-intro.itely b/input/lsr/paper-and-layout-intro.itely new file mode 100644 index 0000000000..c6e7a1cdc0 --- /dev/null +++ b/input/lsr/paper-and-layout-intro.itely @@ -0,0 +1,5 @@ +@node Paper and layout +@unnumberedsec Paper and layout + +@lysnippets + diff --git a/input/lsr/percussion-intro.itely b/input/lsr/percussion-intro.itely index 9c2c6fdb12..94600e5f93 100644 --- a/input/lsr/percussion-intro.itely +++ b/input/lsr/percussion-intro.itely @@ -1,5 +1,5 @@ @node Percussion -@unnumbered Percussion +@unnumberedsec Percussion @lysnippets diff --git a/input/lsr/piano-music-intro.itely b/input/lsr/piano-music-intro.itely index 3cd0e85431..b1ab6a9928 100644 --- a/input/lsr/piano-music-intro.itely +++ b/input/lsr/piano-music-intro.itely @@ -1,5 +1,5 @@ @node Piano -@unnumbered Piano +@unnumberedsec Piano @lysnippets diff --git a/input/lsr/pitches-intro.itely b/input/lsr/pitches-intro.itely index 2d65d94355..06d107d4a9 100644 --- a/input/lsr/pitches-intro.itely +++ b/input/lsr/pitches-intro.itely @@ -1,5 +1,5 @@ @node Pitches -@unnumbered Pitches +@unnumberedsec Pitches @lysnippets diff --git a/input/lsr/repeats-intro.itely b/input/lsr/repeats-intro.itely index bda677755a..71070de15f 100644 --- a/input/lsr/repeats-intro.itely +++ b/input/lsr/repeats-intro.itely @@ -1,5 +1,5 @@ @node Repeats -@unnumbered Repeats +@unnumberedsec Repeats @lysnippets diff --git a/input/lsr/rhythms-intro.itely b/input/lsr/rhythms-intro.itely index a250e5b398..e33b03e9cf 100644 --- a/input/lsr/rhythms-intro.itely +++ b/input/lsr/rhythms-intro.itely @@ -1,5 +1,5 @@ @node Rhythms -@unnumbered Rhythms +@unnumberedsec Rhythms @lysnippets diff --git a/input/lsr/simultaneous-notes-intro.itely b/input/lsr/simultaneous-notes-intro.itely index 321010ab4c..4b2095d095 100644 --- a/input/lsr/simultaneous-notes-intro.itely +++ b/input/lsr/simultaneous-notes-intro.itely @@ -1,5 +1,5 @@ @node Simultaneous notes -@unnumbered Simultaneous notes +@unnumberedsec Simultaneous notes @lysnippets diff --git a/input/lsr/snippets.tely b/input/lsr/snippets.tely index 0f31dcb42b..39e558c924 100644 --- a/input/lsr/snippets.tely +++ b/input/lsr/snippets.tely @@ -6,6 +6,11 @@ @iftex @afourpaper +@c don't replace quotes with directed quotes +@tex +\gdef\SETtxicodequoteundirected{Foo} +\gdef\SETtxicodequotebacktick{Bla} +@end tex @end iftex @finalout @@ -38,6 +43,7 @@ or figure for each example to see the corresponding input file. @end lilypond @c maybe generate/update @menu and @includes automatically? --jm +@ifnottex @menu Musical notation * Pitches:: @@ -60,10 +66,19 @@ Specialist notation * Ancient notation:: Other collections +* Contexts and engravers:: +* Tweaks and overrides:: +* Paper and layout:: +* Titles:: +* Spacing:: +* MIDI:: * Other:: @end menu +@end ifnottex +@iftex @contents +@end iftex @include pitches.itely @include rhythms.itely @@ -83,6 +98,12 @@ Other collections @c @include bagpipes.itely @include ancient-notation.itely +@include contexts-and-engravers.itely +@include tweaks-and-overrides.itely +@include paper-and-layout.itely +@include titles.itely +@include spacing.itely +@include midi.itely @include other.itely @bye diff --git a/input/lsr/spacing-intro.itely b/input/lsr/spacing-intro.itely new file mode 100644 index 0000000000..6dd65960e7 --- /dev/null +++ b/input/lsr/spacing-intro.itely @@ -0,0 +1,5 @@ +@node Spacing +@unnumberedsec Spacing + +@lysnippets + diff --git a/input/lsr/staff-notation-intro.itely b/input/lsr/staff-notation-intro.itely index 4a2103d87e..afad9d2364 100644 --- a/input/lsr/staff-notation-intro.itely +++ b/input/lsr/staff-notation-intro.itely @@ -1,5 +1,5 @@ @node Staff notation -@unnumbered Staff notation +@unnumberedsec Staff notation @lysnippets diff --git a/input/lsr/strings-intro.itely b/input/lsr/strings-intro.itely index 316fef7cb6..3cee4a0467 100644 --- a/input/lsr/strings-intro.itely +++ b/input/lsr/strings-intro.itely @@ -1,5 +1,5 @@ @node Strings -@unnumbered Strings +@unnumberedsec Strings @lysnippets diff --git a/input/lsr/text-intro.itely b/input/lsr/text-intro.itely index 29a4f45e0f..7906eafd49 100644 --- a/input/lsr/text-intro.itely +++ b/input/lsr/text-intro.itely @@ -1,5 +1,5 @@ @node Text -@unnumbered Text +@unnumberedsec Text @lysnippets diff --git a/input/lsr/titles-intro.itely b/input/lsr/titles-intro.itely new file mode 100644 index 0000000000..82ffe28a73 --- /dev/null +++ b/input/lsr/titles-intro.itely @@ -0,0 +1,5 @@ +@node Titles +@unnumberedsec Titles + +@lysnippets + diff --git a/input/lsr/tweaks-and-overrides-intro.itely b/input/lsr/tweaks-and-overrides-intro.itely new file mode 100644 index 0000000000..8c614ed23f --- /dev/null +++ b/input/lsr/tweaks-and-overrides-intro.itely @@ -0,0 +1,5 @@ +@node Tweaks and overrides +@unnumberedsec Tweaks and overrides + +@lysnippets + diff --git a/input/lsr/vocal-music-intro.itely b/input/lsr/vocal-music-intro.itely index 4a3866cca1..2537a476af 100644 --- a/input/lsr/vocal-music-intro.itely +++ b/input/lsr/vocal-music-intro.itely @@ -1,5 +1,5 @@ @node Vocal music -@unnumbered Vocal music +@unnumberedsec Vocal music @lysnippets