[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme code for extracting LilyPond header properties?
From: |
John Zaitseff |
Subject: |
Re: Scheme code for extracting LilyPond header properties? |
Date: |
Tue, 9 Oct 2007 08:34:32 +1000 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Dear Nicolas / LilyPonders,
Nicolas Sceaux wrote:
>
> John Zaitseff writes:
>
> > [...] What I would like to do, however, is to replace the
> > "\fromproperty #'header:maintainer" with something like:
> >
> > \with-url #"mailto:address@hidden"
> > \fromproperty #'header:maintainer
> >
> > except that I would like to extract the actual e-mail address
> > from header:maintainerEmail: something like:
> >
> > \with-url #(string-append "mailto:" XXX)
>
> Ok so basicaly you want a \email-property markup command that
> looks for a header property and outputs something equivalent to:
>
> \with-url #"mailto:..." "..."
>
> [ Actual detailed explanation follows... ]
Thank you very much for your help! I actually wrote the function
to take the header:maintainer AND header:maintainerEmail properties
into account:
% \email-property EMAIL ARG - add a mailto link based on property EMAIL
#(define-markup-command (email-property layout props email arg)
(symbol? markup?)
"Add a mailto link to property @var{email} around @var{arg}.
This only works in the PDF backend."
(let* ((address (chain-assoc-get email props)))
(interpret-markup layout props
(if (string? address)
(markup #:with-url (string-append "mailto:" address) arg)
arg))))
For other people's edification :-), the following is my tagline:
tagline = \markup {
\fontsize #-3.5
\override #'(word-space . 0)
\line {
"Typeset by "
\email-property #'header:maintainerEmail
\fromproperty #'header:maintainer
" using "
\with-url #"http://www.lilypond.org/"
\line {
"LilyPond "
#(ly:export (string-append (lilypond-version) "."))
}
" File version "
\fromproperty #'header:version
", last modified "
\parsed-date #'header:lastupdated
"."
}
}
I store a field in the header, lastupdated, in the form "09-Oct-2007";
the \parsed-date function converts that to something like "9 October,
2007":
% \parsed-date DATE - convert a DD-MMM-YYYY property to a fully printed date
#(define-markup-command (parsed-date layout props date) (symbol?)
"Convert the property @var{date} containing a date in the
form DD-MMM-YYYY into a nicely formatted stencil output D MMMM,
YYYY."
(let* ((datestr (chain-assoc-get date props)))
(interpret-markup layout props
(if (string? datestr)
(markup #:simple
(strftime "%e %B, %Y" (car (strptime "%d-%b-%Y"
datestr))))
datestr))))
(Of course, I should rewrite that to make it somewhat more robust.
It works for me, however).
Once again, thank you for your help.
Yours truly,
John Zaitseff
--
John Zaitseff ,--_|\ The ZAP Group
Phone: +61 2 9643 7737 / \ Sydney, Australia
E-mail: address@hidden \_,--._* http://www.zap.org.au/
v