Felix Janda <[email protected]>
writes:

> On 01/07/13 at 04:59pm, David Kastrup wrote:
>> Felix Janda <[email protected]>
>> writes:
>> 
>> > Hi,
>> >
>> > just some thoughts on the current header parsing of Mutopia's software
>> > motivated by (not wanting to install java and) the thought that lilypond's
>> > language is so complex that parsing it should be left to lilypond itself.
>> 
>> dak@lola:/usr/local/tmp/lilypond$ time lilypond -e "(set!
>> print-book-with-defaults (lambda (parser book) (module-for-each
>> (lambda (sym var) (if (markup? (variable-ref var)) (format #t
>> \"~a=~S\\n\" sym (markup->string (variable-ref var)))))
>> (ly:book-header book))))" input/regression/mozart-hrn-3.ly
>
> Thanks, that's really elegant.
>
> So the expressions in lilypond's -e option are interpreted after the input
> file so that something like print-book-with-defaults, which is usually
> defined in lily-library.scm, can be overidden?
>
> Do you have a (rough) estimate for what's the earliest lilypond
> version which works with this command line?

Huh.  Several functions are only available with

commit eab591fe423ef0eeb03d8bbedf7d43185d2fbc74
Author: Reinhold Kainhofer <[email protected]>
Date:   Mon Dec 27 15:49:30 2010 +0100

    Print out header fields as PDF metadata; Add simple markup->string function
    
    -) Create DOCINFO pdfmark, with the metadata fields extracted
       from the \header block
    
    -) Add scheme function markup->string that extracts and returns only the
       string part of a markup. As all header fields are possibly markups,
       we need to call this function on the header fields and use only
       the string representation (formatting and possibly some information
       lost!) as metadata.
       This function is very simply (for all known text markup functions,
       it extracts the text and ignores the formatting, all other markup
       functions are entirely ignored), so it might not work perfectly
       for complex markups.
    
    -) Add possibility to override a header field with the same name, but
       a pdf prefix, to force a particular metadata string, which is not
       displayed in the pdf. E.g. if the \header block contains
           pdftitle = "Title for pdf file"
       then that pdftitle header field will be used for the document title
       in the PDF metadata instead of the title header field.

so that would be version 2.13.48.

-- 
David Kastrup


_______________________________________________
Mutopia-discuss mailing list
[email protected]
http://lists.bcn.mythic-beasts.com/mailman/listinfo/mutopia-discuss

Reply via email to