Release. Forester 4.0 [00RF]
- April 5, 2024
- Jon Sterling, with contributions from Kento Okura
This is a major release of Forester that changes both the command line interface and the XML format, introducing many new features under the hood as well as quality-of-life improvements (including a 2X rendering speedup).
Forest configuration via TOML [00RG]
- April 5, 2024
- Jon Sterling, with contributions from Kento Okura
Previously, the locations of trees as well as assets and theme directories were configured by means of command line arguments. As this has become a bit unwieldy, especially as many users have multiple projections of their forest, we have consolidated these options under a simple TOML configuration file whose location is the first argument to most forester commands. Here is an example configuration file:
# forest.toml [forest] trees = ["trees"] assets = ["assets"] theme = "theme" root = "0001" base_url = "https://www.jonmsterling.com"
It is common to have multiple configurations. For example, if you have “public” trees located in a specific directory, you can have an additional configuration:
# public.toml [forest] trees = ["trees/public"] assets = ["assets"] theme = "theme" root = "0001" base_url = "https://www.jonmsterling.com"
Both the assets and theme keys are displayed above with their default values, so they could be omitted. There is an additional stylesheet key that can be used to set the name of the XSL stylesheet used (the default is forest.xsl).
To build the forest, simply run: forester build forest.toml; other options can be used (see forester build --help), such as forester build forest.toml --dev.
Enhanced XML support [00RH]
- April 5, 2024
- Jon Sterling
An XML namespace for Forester [00RI]
- April 5, 2024
- Jon Sterling
The XML format is now governed by the XML namespace with URI http://www.forester-notes.org/005P/; as is typical of XML grammars, element names are namespaced whereas attribute names lie in no namespace. Forester emits XML with element names qualified by a prefix bound to this namespace. This change breaks existing XSL stylesheets, so you must upgrade your theme.
The new version of the default theme contains rules to allow anything in either the http://www.w3.org/1999/xhtml or http://www.w3.org/1998/Math/MathML namespaces to be copied through to the output HTML (with namespace prefixes stripped). In combination with § [00RJ], this allows you to write HTML and MathML in Forester directly.
Please note that although Forester now has a namespace, it does not has a schema. Any direct integration with the XML format (e.g. by custom themes) is not supported and should be done at your own risk — several recent releases have illustrated the continued rapid evolution of the XML format with many breaking changes. I expect this evolution will continue for some time.
Emitting XML and resolving namespaces [00RJ]
- April 5, 2024
- Jon Sterling
Since version 3.0, Forester’s source language has supported a limited form of custom XML output by means of the \xml command. This support was, however, somewhat unwieldy: no built-in accounting for XML namespaces was included, so correct usage of \xml was prohibitively difficult because of the need for xmlns attributes on essentially every node.
Feature XML namespace declaration [00RK]
- April 5, 2024
- Jon Sterling
Forester treats XML namespace prefixes in a way that respects \alpha -equivalence: in other words, any prefix mentioned must be bound, and it is possible for two different textually identical namespace prefixes to denote different namespaces depending on their scope. This makes it possible to compose code that emits XML without coordinating namespace prefixes, which I have found to be a major impediment to the correct use of XML for non-trivial work.
An XML namespace prefix is bound by a declaration like the following:
\xmlns:html{http://www.w3.org/1999/xhtml}This declaration has the same scoping rules as \def.
Feature XML literals [00RM]
- April 5, 2024
- Jon Sterling
The old \xml syntax has been replaced with a new convenient notation for XML literals that supports declared XML namespace prefixes. The grammar of XML literals is summarised below:
qname ::= prefix:name | name
expr ::= ... | \<qname>[qname]{expr}...{expr}For example, if the prefix html: is bound to http://www.w3.org/1999/xhtml as in Feature [00RK], the expression \<html:mark>[class]{highlight}{some highlighted text} will emit the following XML:
<html:mark xmlns:html="http://www.w3.org/1999/xhtml" class="highlight"> some highlighted text </html:mark>
In reality, the appropriate @xmlns:html attribute will be attached only where it is needed in keeping with the hierarchical structure of the XML tree. Note that when the same textual prefix is bound to two different namespaces, one of them will be automatically \alpha -renamed so as to result in correct XML with the intended semantics.
Example A worked example [00RL]
- April 5, 2024
- Jon Sterling
The following code causes MathML to be emitted (in the correct namespace), combining Feature [00RK] and Feature [00RM]:
\xmlns:mml{http://www.w3.org/1998/Math/MathML}
\<mml:math>[display]{block}{
\<mml:mrow>{
\<mml:msup>{
\<mml:mi>{x}
\<mml:mn>{2}
}
\<mml:mo>{+}
\<mml:mi>{x}
}
}The above displays as follows: