13. Skribilo User Manual — Engines |
Skribilo documents can be rendered, or output, in a variety of
different formats. When using the compiler, which format is used is
specified by the --target command-line option (see Chapter 14). This command-line option actually
specifies the engine or ``back-end'' to be used, which is
roughly a set of procedures that translate the input document into the
output format. For instance, passing --target=html to the
compiler instructs it to produce an HTML document using the html
engine.
This chapter describes procedures allowing the manipulation of engines in Skribilo documents or modules (creation, customization, etc.), as well as the available engines. Currently, the available engines are:
Engine customization provides tight control over the output produced for each particular engine. In particular, it allows the style for each output to be fine-tuned, be it HTML, PDF via Lout, or anything else. However, note that such fine-tuning usually requires good knowledge of the output format (e.g., HTML/CSS, Lout, LaTeX).The function make-engine
creates a brand new engine.
(make-engine [:info '()
] [:custom '()
] [:symbol-table '()
] [:delegate] [:filter] [:format "raw"
] [:version 'unspecified
] ident
)
ident
The name (a symbol) of the new engine.The function copy-engine
duplicates an existing engine.
(copy-engine [:custom] [:symbol-table] [:delegate] [:filter] [:version 'unspecified
] ident
e
)
ident
The name (a symbol) of the new engine.e
The old engine to be duplicated.The find-engine
function searches in the list of defined
engines. It returns an engine
object on success and #f
on failure.
(find-engine [:version 'unspecified
] id
)
id
The name (a symbol) of the engine to be searched.The predicate engine?
returns #t
if its
argument is an engine. Otherwise, it returns #f
. In other words,
engine?
returns #t
for objects created by
make-engine
, copy-engine
, and find-engine
.
(engine? obj
)
obj
The checked object.The following functions return information about engines.
(engine-ident obj
)
(engine-format obj
)
(engine-customs obj
)
(engine-filter obj
)
(engine-symbol-table obj
)
obj
The engine.Engine customs are locations where dynamic informations relative
to engines can be stored. Engine custom can be seen a global variables that
are specific to engines. The function engine-custom
returns the
value of a custom or #f
if that custom is not defined. The
function engine-custom-set!
defines or sets a new value for
a custom.
(engine-custom-set! e
id
val
)
e
The engine (as returned by
find-engine
).id
The name of the custom.val
The new value of the custom.In the documentation of available engines that follows, a list of available customs is shown for each engine, along with each custom's default value and a description.
Writing new engines (i.e., output formats) and making them
available to Skribilo is an easy task. Essentially, this boils down to
instantiating an engine using make-engine
and
registering markup writers using the markup-writer
procedure for all supported markups (e.g., chapter, bold, etc.)1.
Most likely, you will want to make your new engine visible
so that find-engine
and consequently the --target command-line option can find it. To that end, a few rules
must be followed:
make-engine
must be bound, in that module, to a variable called, say, foo-engine;