]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add LSR tags and improve LSR snippets presentation
authorJohn Mandereau <john.mandereau@gmail.com>
Wed, 2 Jan 2008 15:51:14 +0000 (16:51 +0100)
committerJohn Mandereau <john.mandereau@gmail.com>
Wed, 2 Jan 2008 15:51:14 +0000 (16:51 +0100)
- 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.

27 files changed:
buildscripts/lys-to-tely.py
buildscripts/makelsr.py
input/lsr/GNUmakefile
input/lsr/ancient-notation-intro.itely
input/lsr/bagpipes-intro.itely
input/lsr/chords-intro.itely
input/lsr/contexts-and-engravers-intro.itely [new file with mode: 0644]
input/lsr/editorial-and-educational-use-intro.itely
input/lsr/expressive-marks-intro.itely
input/lsr/guitar-intro.itely
input/lsr/midi-intro.itely [new file with mode: 0644]
input/lsr/other-intro.itely
input/lsr/paper-and-layout-intro.itely [new file with mode: 0644]
input/lsr/percussion-intro.itely
input/lsr/piano-music-intro.itely
input/lsr/pitches-intro.itely
input/lsr/repeats-intro.itely
input/lsr/rhythms-intro.itely
input/lsr/simultaneous-notes-intro.itely
input/lsr/snippets.tely
input/lsr/spacing-intro.itely [new file with mode: 0644]
input/lsr/staff-notation-intro.itely
input/lsr/strings-intro.itely
input/lsr/text-intro.itely
input/lsr/titles-intro.itely [new file with mode: 0644]
input/lsr/tweaks-and-overrides-intro.itely [new file with mode: 0644]
input/lsr/vocal-music-intro.itely

index a9186627d8a839674d6eff7e6bf50e62aca329a3..c026522434e37b77a453592aaca71487c2e5b1b3 100644 (file)
@@ -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:
index c4f512ae51a344c0a97c8f2cec974ff770266092..69fac25f0c710a38f16c25c10890fa56e7ea907a 100755 (executable)
@@ -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:
index 6092e6058af8fa48603afe2b7212adcf8232ed78..df45b7322251c9787f0644a178f6701c80e3c748 100644 (file)
@@ -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) $<
index 52a221029e03c6955caddfc8ad5f327e0526a821..4f6d24012e22f16b50776ad0971db84e71af50e7 100644 (file)
@@ -1,5 +1,5 @@
 @node Ancient notation
-@unnumbered Ancient notation
+@unnumberedsec Ancient notation
 
 @lysnippets
 
index 64b7a086587ec91646e7dacdc5842ed4bef08a1f..67b897e84f66b7aa330b6b13a894b3079d08facf 100644 (file)
@@ -1,5 +1,5 @@
 @node Bagpipes
-@unnumbered Bagpipes
+@unnumberedsec Bagpipes
 
 @lysnippets
 
index c9980477efcab8fce1be5d87ca590149bf42dbd0..537014c3cb8011f81afef8fc9dfc6dd3b17424ff 100644 (file)
@@ -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 (file)
index 0000000..c4f8a81
--- /dev/null
@@ -0,0 +1,5 @@
+@node Contexts and engravers
+@unnumberedsec Contexts and engravers
+
+@lysnippets
+
index d014a36d8a4dea2b42c6021deaba7d64a08c571b..83188738bbb7e9b0c792cc9423c38edde9451ceb 100644 (file)
@@ -1,5 +1,5 @@
 @node Editorial and educational use
-@unnumbered Editorial and educational use
+@unnumberedsec Editorial and educational use
 
 @lysnippets
 
index 6b6550dd36a1962cbab426811b7b607c2a16562e..340e428b3a5898f1acdae701ebf83404b4a38a4b 100644 (file)
@@ -1,5 +1,5 @@
 @node Expressive marks
-@unnumbered Expressive marks
+@unnumberedsec Expressive marks
 
 @lysnippets
 
index 931ad7a54ee47255afde7610a82eeb983ebb7e5b..2cfb2517ce6f4bd7a363e1f10fd0ef18532e4909 100644 (file)
@@ -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 (file)
index 0000000..5f9f4f9
--- /dev/null
@@ -0,0 +1,5 @@
+@node MIDI
+@unnumberedsec MIDI
+
+@lysnippets
+
index 795a15b8e3227c9abe519b2919d55fbe1ead51f4..f09196f04ad518ea544dbcb60ce6a2fd409f0aad 100644 (file)
@@ -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 (file)
index 0000000..c6e7a1c
--- /dev/null
@@ -0,0 +1,5 @@
+@node Paper and layout
+@unnumberedsec Paper and layout
+
+@lysnippets
+
index 9c2c6fdb12dbd1ccdfd513fe4d7a825027ba396d..94600e5f93f5c49686b70030738c7ad173e62af6 100644 (file)
@@ -1,5 +1,5 @@
 @node Percussion
-@unnumbered Percussion
+@unnumberedsec Percussion
 
 @lysnippets
 
index 3cd0e854315eb644cb2d6a1f570d5f70d04ab76b..b1ab6a992818e225633d6f21a8e175dd8ac1c87a 100644 (file)
@@ -1,5 +1,5 @@
 @node Piano
-@unnumbered Piano
+@unnumberedsec Piano
 
 @lysnippets
 
index 2d65d943550f9433ffd7be7cca72f4a00971d170..06d107d4a920c1a9364bf491e4a017412c345f1e 100644 (file)
@@ -1,5 +1,5 @@
 @node Pitches
-@unnumbered Pitches
+@unnumberedsec Pitches
 
 @lysnippets
 
index bda677755af584db9582ba0eca21e325db08ceec..71070de15f9460e5a3f94b9731f97008b1d68f46 100644 (file)
@@ -1,5 +1,5 @@
 @node Repeats
-@unnumbered Repeats
+@unnumberedsec Repeats
 
 @lysnippets
 
index a250e5b39870edddd98a438e77f3739b303481fe..e33b03e9cfd0dbf2d42082dfd8dfc6ba03fe79c7 100644 (file)
@@ -1,5 +1,5 @@
 @node Rhythms
-@unnumbered Rhythms
+@unnumberedsec Rhythms
 
 @lysnippets
 
index 321010ab4c8a1dba0e53856e815750d3a538edaf..4b2095d09582c175b4fed14c26f3d1808630a9ec 100644 (file)
@@ -1,5 +1,5 @@
 @node Simultaneous notes
-@unnumbered Simultaneous notes
+@unnumberedsec Simultaneous notes
 
 @lysnippets
 
index 0f31dcb42b48e4db6630ab594a0364154bae2238..39e558c92416f6234229e1134642e9e46f52f309 100644 (file)
@@ -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 (file)
index 0000000..6dd6596
--- /dev/null
@@ -0,0 +1,5 @@
+@node Spacing
+@unnumberedsec Spacing
+
+@lysnippets
+
index 4a2103d87e103fc93465dc71c161e0ca1b31a75d..afad9d2364c003f45f6110fc93ceb084ca770dc5 100644 (file)
@@ -1,5 +1,5 @@
 @node Staff notation
-@unnumbered Staff notation
+@unnumberedsec Staff notation
 
 @lysnippets
 
index 316fef7cb63f4c7d9548f0bbf3480c2ba6a927d4..3cee4a0467c58c63b86d2e8b2ef2847bfdd57493 100644 (file)
@@ -1,5 +1,5 @@
 @node Strings
-@unnumbered Strings
+@unnumberedsec Strings
 
 @lysnippets
 
index 29a4f45e0f271da1a576a4653f79f8b0cca152de..7906eafd497dd4cd9a28d0458ca03905fc79f195 100644 (file)
@@ -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 (file)
index 0000000..82ffe28
--- /dev/null
@@ -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 (file)
index 0000000..8c614ed
--- /dev/null
@@ -0,0 +1,5 @@
+@node Tweaks and overrides
+@unnumberedsec Tweaks and overrides
+
+@lysnippets
+
index 4a3866cca1d2b2260fcfbe9bb52cadd455f8be77..2537a476afefad0e1b14fd9ee21d5d75e95a1bd3 100644 (file)
@@ -1,5 +1,5 @@
 @node Vocal music
-@unnumbered Vocal music
+@unnumberedsec Vocal music
 
 @lysnippets