This chapter describes the forms composing Skribe texts. In XML/HTML
these forms are called
markups. In LaTeX they are called
macros. In Skribe these forms are called
functions. In this manual, we will say that we
call a
function when a function is used in a form. The values used in a
function call are named the
actual parameters of the
function or
parameters in short. When calling a function
with parameters we say that we are
passing arguments to the
function.
In this documentation function names are typesetted in bold
face. We call a keyword argument, an argument whose
identifier starts with the : character. Arguments whose
identifier does not start with this character are called plain
arguments or arguments in short. An optional
argument is represented by a list, starting with the character "[" and ending with the character "]", whose first
element is a keyword argument and the optional second (#f
when not specified) element is the default value used if the optional
argument value is not provided on a function call. Arguments that are
not optional are said mandatory. If a plain argument is
preceeded with a . character, this argument may be used to
accumulate several values. There are two ways to pass actual arguments
to a function.
- for keyword arguments: the value of the parameter
must be preceeded by the name of the argument.
- for plain arguments: a value is provided.
Example: Let us consider the function
section defined as follows:
(section :title [:number #t] [:toc #t] . body)
|
|
The argument title is a mandatory keyword argument.
The keyword arguments number and toc are
optional. The plain argument body
is preceeded with a
. character so it may receive several values. All the following
calls are legal section calls:
(section :title "A title" "This is the body of the section")
(section :title "A title" "This" " is" " the body of the section")
(section :title "A title" :number 3 "This" " is" " the body of the section")
(section :title "A title" :toc #f :number 3 "This" " is" " the body of the section")
(section :title "A title" :number 3 :toc #f "This" " is" " the body of the section")
|
|