Lady [Thu, 11 Jan 2024 01:20:38 +0000 (20:20 -0500)]
Make X·M·L types take priority over plaintext ones
If `XMLTYPES` defines something as X·M·L, it should be treated as
X·M·L, regardless of whether there is a parser which claims to support
it.
This avoids awkward footguns where a parser might transform and claim
support for (through `@书社:supported-media-types`) an X·M·L dialect,
resulting in ⛩️📰 书社 treating that type as plaintext and wrapping it
in an `<html:script>` element. X·M·L types listed in
`@书社:supported-media-types` should instead not have any effect
(⛩️📰 书社 should not require parsers to reparse X·M·L).
This commit also removes the unused `simpletypes` variable; it was
formerly used for categorization of types into plaintext or asset prior
to the implementation of automatic detection.
Lady [Thu, 11 Jan 2024 01:20:19 +0000 (20:20 -0500)]
Allow separate find rules for includes
This hypothetically enables the situation where `SRCDIR` and
`INCLUDEDIR` are the same, and files are grouped into one or the other
by some other factor.
Lady [Thu, 11 Jan 2024 01:19:32 +0000 (20:19 -0500)]
Do not follow symbolic links with `find`
⛩️📰 书社 expects that source files exist within `SRCDIR` and includes
exist within `INCLUDEDIR`. Following symlinks can break this
assumption. Other commands should follow symlinks by default, so there
shouldn’t be any need to resolve them this early in the process.
Lady [Thu, 11 Jan 2024 01:15:56 +0000 (20:15 -0500)]
Update readme documentation
- Provide more information regarding parsers, including X·M·L parsers.
- Update advice on allowed characters, to exclude all Ascii characters
not allowed in u·r·i’s as well as those known to cause potential
commandline problems.
- Improve the documentation regarding BUILDDIR and DESTDIR
Lady [Sat, 6 Jan 2024 03:59:15 +0000 (22:59 -0500)]
Add <书社:apply-attributes> transformation
The behaviour of `transforms/asset.xslt` is useful, but limited in that
the H·T·M·L elements it creates don’t have any attributes beyond
`@src`. `<书社:apply-attributes>` fixes this by allowing attributes to
be declared in a parent element which wraps the `<书社:link>`.
Lady [Sat, 6 Jan 2024 02:31:17 +0000 (21:31 -0500)]
Fix magic file generation in non‐default location
As it turns out, `file -C` always creates a file named `magic.mgc` in
the current working directory. Navigate to the build directory before
calling it instead of moving the file after.
Lady [Mon, 1 Jan 2024 22:18:49 +0000 (17:18 -0500)]
Provide a mechanism to override parser media types
If `@书社:supported-media-types` is present on the root element of a
parser, the normal media type detection is disabled and the value of
the attribute is used instead.
Lady [Mon, 1 Jan 2024 20:49:15 +0000 (15:49 -0500)]
Re·order remakes to (again) fix restarts
In cases where `$(BUILDDIR)/dependencies` exists but
`$(BUILDDIR)/.update-types` (initially) does not, it is important to
check for dependency updates *first*, prior to checking for parser
updates. This is because when parsers are updated, the dependency file
will be deleted, causing the dependency reload recipe to activate
immediately (prior to a restart) if it hasn’t already been checked.
Having correct behaviour depend on the ordering of these recipes isn’t
ideal, but the alternative is checking whether
`$(BUILDDIR)/.update-types` was created *in the course of processing
the make·file* and disabling dependency creation until the next restart
if it had been. This sounds unbearably complex and difficult to phrase
in a readable manner.
Lady [Mon, 1 Jan 2024 19:00:12 +0000 (14:00 -0500)]
Improve asset transforms
This commit converts `audio/*`, `image/*` and `video/*` embeds to their
appropriate H·T·M·L element, enables inline `<html:style>`s, and
improves the handling of `text/css` embeds.
Lady [Mon, 1 Jan 2024 18:40:20 +0000 (13:40 -0500)]
Allow inserting nodes before and after result
This commit adds two new modes akin to `书社:metadata`: `书社:header`,
which supplies nodes to insert at the beginning of the `<html:body>`,
and `书社:footer`, which supplies nodes to insert at the end. Like
`书社:metadata`, these modes do not run if output wrapping is disabled.
Lady [Mon, 1 Jan 2024 16:49:24 +0000 (11:49 -0500)]
Automatically encapsulate metadata and preserve it
During the embedding phase, give top‐level elements and embeds
`@itemscope` properties as well as a `@itemtype` which indicates which
they are. Don’t remove microdata from the output, and make use of these
properties when processing to ensure only document metadata is actually
used.
Lady [Mon, 1 Jan 2024 16:19:37 +0000 (11:19 -0500)]
Allow creation of metadata without matching result
Each node in the result can only be matched once in any given mode, and
transforms need a mechanism for inserting elements without requiring a
match. This commit gives them a means of doing so by also matching
every `<xslt:include>` in the main transform. If a transform has a
`书社:id` top‐level element which is an i·r·i, then its include will
have a corresponding attribute, and transforms can (by convention)
match this include without fear of conflicts.
This commit also makes the expansion and result available as top‐level
variables in the `书社:` namespace, so that transforms can easily match
within them.
Lady [Mon, 1 Jan 2024 06:32:28 +0000 (01:32 -0500)]
Fix/improve restarts by just waiting a sec
The previous method of attempting to retroactively reduce the timestamp
of the make·file when compiling dependencies hasn’t seemed reliable in
practice and probably isn’t portable either. However, a simple
`sleep 1` after touching the make·file but before the first restart
seems to reliably ensure the second restart happens.