-
Notifications
You must be signed in to change notification settings - Fork 38
Common Functionality
Activating openLilyLib
automatically loads some common functionality which is
then available for anybody, be it document authors or library developers. This
page and its sub-pages provide a reference to this part of openLilyLib
.
openLilyLib
provides a unified interface to option and configuration handling
that can be used by document authors too. Read more on Option-Handling.
openLilyLib
provides a unified interface to provide logging information. Read
more on Logging.
openLilyLib
implements or loads functionality that is needed for it to work
properly. All of this functionality is of course available for any document
author or library developer too.
Often developers locally define predicates to be used by their functions.
openLilyLib
encourages them to consider adding them to the global collection
of predicates - in order to reduce redundancy in the code.
Available predicates in openLilyLib
are:
-
stringlist?
returns#t
if the argument is a list and all of its elements are strings -
string-or-alist?
returns#t
if the argument is either a string or a list of pairs.
Version predicates can be used to conditionally execute code based on the LilyPond version that is currently compiling the document. This makes it possible to write code that can be compiled with different LilyPond versions even when there are breaking syntax changes in between. For individual users this may seem unnecessary but it can become a life-saver if you collaborate with others or if you provide a library and don't want to prescribe a certain (usually: minimal) LilyPond version to your users. The available predicates are:
lilypond-greater-than?
lilypond-greater-than-or-equal?
lilypond-less-than?
lilypond-less-than-or-equal?
-
lilypond-equals?
.
The LilyPond version to be compared agains can be passed either a version string or as a list of three integers, like
#(if (lilypond-greater-than? "2.19.7") #t #f)
#(if (lilypond-less-than? '(2 19 6) #t #f)
The os-path
Scheme module provides a number of functions to deal with file
paths in an OS independent way, similar to Python's os.path
module. It provides
numerous functions that may be useful for document authors as well. Read more
on Path-Handling.
Association lists are a very common data structure when working with LilyPond,
and openLilyLib
makes heavy use of them for its option handling. Therefore
a number of helper commands are available. Read more on Association-List-Support.
-
\includePattern
TODO: CHECK IF THIS REALLY WORKS