From: Werner Lemberg Date: Sun, 31 Oct 2004 08:48:08 +0000 (+0000) Subject: Resetting @exampleindent to `5' gives ugly results with texinfo's X-Git-Tag: release/2.4.2~3^2~32 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=555584529da4f5ec048e0c41413f52ba9e71bf77;p=lilypond.git Resetting @exampleindent to `5' gives ugly results with texinfo's DVI output. Use `@format @exampleindent 0 ... @end format' instead (if not quoting) to change @exampleindent only locally. * scripts/lilypond-book.py (NOQUOTE): New variable. (output) [LATEX]: Remove AFTER and BEFORE. [TEXINFO]: Remove AFTER and BEFORE. Fix QUOTE and VERBATIM pattern. Add NOQUOTE pattern. (Lilypond_snippet) [output_info, output_latex]: Don't handle AFTER and BEFORE. [output_texinfo]: Use NOQUOTE. --- diff --git a/ChangeLog b/ChangeLog index c513f15bfd..26d6972d8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2004-10-31 Werner Lemberg + + Resetting @exampleindent to `5' gives ugly results with texinfo's + DVI output. Use `@format @exampleindent 0 ... @end format' instead + (if not quoting) to change @exampleindent only locally. + + * scripts/lilypond-book.py (NOQUOTE): New variable. + (output) [LATEX]: Remove AFTER and BEFORE. + [TEXINFO]: Remove AFTER and BEFORE. + Fix QUOTE and VERBATIM pattern. + Add NOQUOTE pattern. + (Lilypond_snippet) [output_info, output_latex]: Don't handle AFTER + and BEFORE. + [output_texinfo]: Use NOQUOTE. + 2004-10-31 Graham Percival * Documentation/user/changing-defaults.itely: clarify paper @@ -75,7 +90,6 @@ * scm/lily.scm (ly:system): new function. Catches uninstalled ps2png. ->>>>>>> 1.2778 2004-10-29 Han-Wen Nienhuys * Documentation/user/notation.itely: remove @@ -90,6 +104,7 @@ (ly_options): Remove NOINDENT and EXAMPLEINDENT patterns. (compose_ly): Use `no_options' and `simple_options'. Fix logic of option handling. + Handle `linewidth' option without parameter. 2004-10-29 Han-Wen Nienhuys diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index c08b25915a..db46a843fe 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -125,6 +125,7 @@ LAYOUT = 'layout' LINEWIDTH = 'linewidth' NOFRAGMENT = 'nofragment' NOINDENT = 'noindent' +NOQUOTE = 'noquote' NOTES = 'body' NOTIME = 'notime' OUTPUT = 'output' @@ -139,7 +140,8 @@ TEXIDOC = 'texidoc' TEXINFO = 'texinfo' VERBATIM = 'verbatim' -# NOTIME has no opposite so it isn't part of this dictionary +# NOTIME has no opposite so it isn't part of this dictionary. +# NOQUOTE is used internally only. no_options = { NOFRAGMENT: FRAGMENT, NOINDENT: INDENT, @@ -431,16 +433,13 @@ output = { %(str)s ''', + VERBATIM: r'''
 %(verb)s
''', }, ## LATEX: { - AFTER: '', - - BEFORE: '', - OUTPUT: r'''{%% \parindent 0pt \catcode`\@=12 @@ -482,10 +481,6 @@ output = { %(code)s @lilypond''', - AFTER: '', - - BEFORE: '', - OUTPUT: r'''@noindent @image{%(base)s,,,[image of music],%(ext)s}''', @@ -493,15 +488,16 @@ output = { ''', QUOTE: r'''@quotation -%(str)s -@end quotation +%(str)s@end quotation +''', + + NOQUOTE: r'''@format +%(str)s@end format ''', - # FIXME: @exampleindent 5 is the default... VERBATIM: r'''@exampleindent 0 @example %(verb)s@end example -@exampleindent 5 ''', }, } @@ -629,8 +625,26 @@ def compose_ly (code, options, type): # defaults relative = 1 override = {} - # FIXME: Where to get sane value for exampleindent? - # In texinfo.tex, its maximum value is 0.4in, so we use that. + # The concept of the `exampleindent' option is broken. It is not + # possible to get a sane value for @exampleindent at all without + # processing the document itself. Saying + # + # @exampleindent 0 + # @example + # ... + # @end example + # @exampleindent 5 + # + # causes ugly results with the DVI backend of texinfo since the + # default value for @exampleindent isn't 5em but 0.4in (or a smaller + # value). Executing the above code changes the environment + # indentation to an unknown value because we don't know the amount + # of 1em in advance since it is font-dependent. Modifying + # @exampleindent in the middle of a document is simply not + # supported within texinfo. + # + # To set @exampleindent locally to zero, we use the @format + # environment for non-quoted snippets. override[EXAMPLEINDENT] = r'0.4\in' override[LINEWIDTH] = None override.update (default_ly_options) @@ -912,15 +926,13 @@ class Lilypond_snippet (Snippet): def output_info (self): str = self.output_print_filename (HTML) - str = output[TEXINFO][BEFORE] % vars () for image in self.get_images (): (base, ext) = os.path.splitext (image) - # URG, makeinfo implicitely prepends dot to ext + # URG, makeinfo implicitly prepends dot to ext # specifying no extension is most robust ext = '' str += output[TEXINFO][OUTPUT] % vars () - str += output[TEXINFO][AFTER] % vars () return str def output_latex (self): @@ -934,9 +946,7 @@ class Lilypond_snippet (Snippet): if QUOTE in self.options: str = output[LATEX][QUOTE] % vars () - str += (output[LATEX][BEFORE] - + (output[LATEX][OUTPUT] % vars ()) - + output[LATEX][AFTER]) + str += (output[LATEX][OUTPUT] % vars ()) return str def output_print_filename (self,format): @@ -963,6 +973,8 @@ class Lilypond_snippet (Snippet): if VERBATIM in self.options: verb = verbatim_texinfo (self.substring ('code')) str += (output[TEXINFO][VERBATIM] % vars ()) + if not QUOTE in self.options: + str = output[TEXINFO][NOQUOTE] % vars() str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n') str += ('@tex\n' + self.output_latex () + '\n@end tex\n')