lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing header information for use in a Scheme script


From: Rafael Ramirez Morales
Subject: Accessing header information for use in a Scheme script
Date: Wed, 17 Feb 2016 02:19:05 +0100

Hello,

I'm trying to access the information of the values in the \header section.

I would like to use these values (if defined) to generate automatically a markup.

More specifically, given a value for the copyright in the header, I wanted to generate a variable with the copyright notice (in the example, define a copyrightUse variable with preset text.)

%% BEGIN miniscript

#(define license-alist '(
                          ( "Public Domain" . "free to duplicate, distribute, modify, and perform" ) 
                          ( "Copyright" . "All rights reserved." )
                          )
   )

#(if (assoc 'copyright license-alist)
     (define copyrightUse
       (cdr (assoc copyright license-alist)))
     (define copyrightUse "Unknown copyright status. Some or all rights reserved."))

%% END miniscript

The miniscript works so long as the 'copyright variable is manually defined (as a string) elsewhere. What I would like is to get the value for 'copyright directly from the header.

I have tried many things, including the fromproperty approach and the ideas in the snippet in the repositories markupWithHeader... to no avail. Alas, it seems the header variables get wrapped up is something that I have not been able to unravel in order to reach the naked value.

The basic idea (which I would like to apply to any header field) would be:
1/ test if the variable is defined in header or not.
If not defined, maybe propose a default value.
2/ test if the variable is markup or not.
If it is markup, probably leave it as-is...
3/ If the variable is a string, get that value and proceed to compare said value to, for example, a list of standard values, and then go crazy making derived markups or other subroutines based on this information.

If anyone has a solution, idea, or a solid push in a good direction, my very badly banged head would greatly appreciate.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]