Tagline: optionally include bandname and commithash

This commit is contained in:
Eric Teunis de Boone 2023-05-17 12:43:22 +02:00
parent 2bd978a5d0
commit fb6fa6d677
4 changed files with 52 additions and 39 deletions

View File

@ -12,15 +12,14 @@
\include "./pipeband.sly" \include "./pipeband.sly"
bandname = "Canadian Memorial Pipes and Drums" bandname = "Canadian Memorial Pipes and Drums"
bandnameFull = "Canadian Memorial Pipes and Drums of Holland" bandnameFull = "Canadian Memorial Pipes and Drums of Holland"
bandnameTagline = \bandnameFull bandnameTagline = \bandnameFull
bandnameShort = "CMPD" bandnameShort = "CMPD"
bandWebsite = "https://canadianmemorialpipesanddrums.nl" bandUrl = "https://canadianmemorialpipesanddrums.nl"
% Reload the tagline % Reload the tagline
\include "./defs/tagline_band.ily" \include "./defs/tagline.ily"
% Reset the TitleMarkup % Reset the TitleMarkup

View File

@ -1,4 +1,4 @@
%{0 %{
Tagline. Customize to get your name in the tag line. Tagline. Customize to get your name in the tag line.
%} %}
@ -7,13 +7,44 @@
%%% See LSR 567: http://lsr.di.unimi.it/LSR/Item?id=567 %%% See LSR 567: http://lsr.di.unimi.it/LSR/Item?id=567
#(use-modules (ice-9 popen)) #(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim)) #(use-modules (ice-9 rdelim))
today = #(strftime "%Y-%m-%d" (localtime (current-time)))
commit = commit =
#(let* ((port (open-pipe* OPEN_READ "git" "rev-parse" "--short" "HEAD")) #(let* ((port (open-pipe* OPEN_READ "git" "rev-parse" "--short" "HEAD"))
(str (read-line port))) (str (read-line port)))
(close-pipe port) (close-pipe port)
str) str)
today = #(strftime "%Y-%m-%d" (localtime (current-time))) #(if (eof-object? commit) (set! commit ""))
#(define-once commitUrl "")
#(define-once bandWebsite "")
#(define-once bandname "")
#(define-once bandnameFull bandname)
#(define-once bandUrl "")
#(define-once bandnameTagline (if (not (string-null? bandnameFull)) bandnameFull
(if (not (string-null? bandname)) bandname
(if (not (string-null? bandUrl)) bandUrl ""))))
#(if (and (not (string-null? commitUrl)) (not (string-null? commit)))
(set! commitUrl (string-append commitUrl commit)))
#(define (print-bandname-in-tagline layout props)
"Whether to print any bandname in the tagline."
(and
(string? bandnameTagline)
(not (string-null? bandnameTagline))
)
)
#(define (print-commit-hash-in-tagline layout props)
"Whether to print a commit hash in the tagline."
(and
(string? commit)
(not (string-null? commit))
)
)
\paper { \paper {
tagline = \markup { tagline = \markup {
@ -21,8 +52,21 @@ today = #(strftime "%Y-%m-%d" (localtime (current-time)))
\with-url #"http://lilypond.org" #(format #f "Typeset with LilyPond ~a" (lilypond-version) ) \with-url #"http://lilypond.org" #(format #f "Typeset with LilyPond ~a" (lilypond-version) )
", " ", "
\with-url #"https://etdeboone.nl" "by ET de Boone" \with-url #"https://etdeboone.nl" "by ET de Boone"
", " % optionally include a bandname
\concat { "(rev. " \today ", #" \commit ")" } \if \print-bandname-in-tagline
{
", "
\with-url #bandUrl \bandnameTagline
}
" "
"(rev. " \today
% optionally include the commit hash
\if \print-commit-hash-in-tagline
{
", "
\with-url #commitUrl \concat { "#" #commit }
}
")"
} }
} }
} }

View File

@ -1,30 +0,0 @@
%{
Tagline. Customize to get your name in the tag line.
%}
\version "2.16.0"
%%% See LSR 567: http://lsr.di.unimi.it/LSR/Item?id=567
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))
commit =
#(let* ((port (open-pipe* OPEN_READ "git" "rev-parse" "--short" "HEAD"))
(str (read-line port)))
(close-pipe port)
str)
today = #(strftime "%Y-%m-%d" (localtime (current-time)))
\paper {
tagline = \markup {
\concat {
\with-url #"http://lilypond.org" #(format #f "Typeset with LilyPond ~a" (lilypond-version) )
", "
\with-url #"https://etdeboone.nl" "by ET de Boone"
", "
\with-url #bandWebsite \bandnameFull
", "
\concat { "(rev. " \today ", #" \commit ")" }
}
}
}

View File

@ -31,10 +31,10 @@ bandname = "Seaforth Highlanders of Holland"
bandnameFull = "Seaforth Highlanders of Holland Memorial Pipes and Drums" bandnameFull = "Seaforth Highlanders of Holland Memorial Pipes and Drums"
bandnameTagline = "Seaforths of Holland" bandnameTagline = "Seaforths of Holland"
bandnameShort = "Seaf" bandnameShort = "Seaf"
bandWebsite = "https://seaforth.nl" bandUrl = "https://seaforth.nl"
% Seaforth Tagline % Seaforth Tagline
\include "defs/tagline_band.ily" \include "defs/tagline.ily"
\layout { \layout {
indent = 0.0 indent = 0.0