Section 26.1 Publisher File
As of 2021-01-23 we are well along on a transition to providing options a publisher would choose via an XML publisher file. Here we describe how to create and employ this file. Details on actual options can be found throughout this guide, with terse comprehensive reference material in Chapter 40. Note too, that Section 26.6 describes the old method (which is still in use, but will eventually be obsolete).
Create a separate XML file the same way you always would. Include the usual XML declaration as the first line. Now, instead of the overall element being
<publication>. That's it. Various elements within
<publication> will be used to specify options, typically attributes. Name the file something that reminds you of its purpose, such as
pod.xml for a print-on-demand version. Avoid using spaces in the filename, even if your operating system encourages it.
Entries that control aspects of the output are often attributes of various elements, but may also be the content of elements. When you read the reference material in Chapter 40 be aware that we use a sort of shorthand to describe these entries, modeled on a specification called XPath. For example, if we say to set
to possible values of
maybe then the following will be the guts of a legitimate publisher file that would somehow adjust your output in some way. In particular, note that the “at sign”,
@, indicates an attribute of the preceding element.
<publication> <foo> <bar bazz="maybe"/> </foo> </publication>
The path to a publisher file can be specified using the
-p option for
pretext build. For example, if your publisher file is
publication.ptx in the folder
publication (parallel to
source), you would enter the following.
pretext build html -p publication/publication.ptx
Alternatively, you can specify the path to the publisher file in the
project.ptx manifest in the
<publication> element for each
<target>, allowing you to have a different publisher file for different targets.