]> Lady’s Gitweb - Shushe/log
Shushe
2 weeks agoSet up DOCUMENTATION current
Lady [Sat, 25 May 2024 04:04:47 +0000 (00:04 -0400)]
Set up DOCUMENTATION

2 weeks agoMinor updates to comments
Lady [Thu, 22 Aug 2024 01:37:31 +0000 (21:37 -0400)]
Minor updates to comments

- Update makefileinfo to match README regarding Posix requirements.

- Remove verbose CC0 marking, as the SPDX tags have equivalent effect.

2 weeks agoImprove <书社:apply-attributes>, @书社:archived-as
Lady [Tue, 20 Aug 2024 06:22:17 +0000 (02:22 -0400)]
Improve <书社:apply-attributes>, @书社:archived-as

- `<书社:apply-attributes>` should not prevent H·T·M·L from wrapping.
  Note that the H·T·M·L wrapper is still not
  `<书社:apply-attributes>`‐aware; it will _not_ seek into the wrapped
  contents to search for attributes to pull upwards to the root
  element. This could probably be improved.

- `@书社:archived-as` can now be applied to `<书社:link>` and will be
  passed down to any embedded contents.

- `@书社:archived-as` will not be deleted during attribute application
  onto the root element; it now ensures there is a nonroot, nonarchive
  ancestor. This is required because archive children are processed
  into a separate document prior to application.

  An alternative approach might be to wrap archive children in a
  `<书社:archive>` element before application and then strip it after,
  but this is a fair bit of added work for little benefit. It’s a fair
  question whether removing invalid `@书社:*` attributes like this is
  even a good practice—invalid `<书社:link>` elements are maintained,
  in contrast.

5 weeks agoImprove dependency tracking
Lady [Sat, 3 Aug 2024 18:04:28 +0000 (14:04 -0400)]
Improve dependency tracking

- Add a `.metadata-format-changed-since` file which is a dependency for
  metadata generation. The hope is that this file will change when·ever
  the metadata format does, forcing a rebuild of stale metadata.

- Add `PARSERLIBS` and `TRANSFORMLIBS` (and `EXTRA⸺` variants) to
  enable rebuilds on changes to files that parsers or transforms depend
  on.

5 weeks agoAdd H·T·M·L microdata to archive children
Lady [Sat, 3 Aug 2024 17:21:55 +0000 (13:21 -0400)]
Add H·T·M·L microdata to archive children

These attributes (`@itemscope` and `@itemtype`) are normally added at
the beginning of expansion to the root node of the document, prior to
it being wrapped. With archives, they should be added to archive
children as part of the processing which happens during application,
just prior to the wrapping which likewise occurs there. Having these
attributes present is important for title microdata processing (which
happens as a part of wrapping) to work correctly.

As part of this work, microdata handling is improved slightly in all
cases.

Note: If the `@itemscope` or `@itemtype` attributes were already
present on the children of the archive element, for example because
the child was the result of an embed, they will not necessicarily be
adjusted. It’s necessary to remove any embed typing during normal
processing if document typing is desired during the application phase.

5 weeks agoFix transform from sometimes expanding twice
Lady [Sat, 3 Aug 2024 16:56:59 +0000 (12:56 -0400)]
Fix transform from sometimes expanding twice

The default behaviour for processing expanded replacements of
`<书社:link>` elements was to expand them again, which was wrong,
beccause they have already been expanded once. They should just be
copied instead.

This line was probably copied from the default behaviour for
`<书社:link>` elements which are not expanded or replaced, where it is
the correct behaviour.

5 weeks agoProvide source file in metadata to transforms
Lady [Thu, 4 Jul 2024 19:04:47 +0000 (15:04 -0400)]
Provide source file in metadata to transforms

While I’ve generally resisted doing this, since tranforms _should_
generally always be looking at the parsed form of the file and not the
original, having access to this property is necessary in some cases to
enable embedding the original source file within the tranformation
result (e·g, when the source file is X·M·L, and there are parsers which
preprocess it). When the source file is _not_ X·M·L, this property is
probably use·less, but included never·the·less.

5 weeks agoFix/improve recursive dependency detection
Lady [Wed, 3 Jul 2024 01:42:56 +0000 (21:42 -0400)]
Fix/improve recursive dependency detection

The old method of detecting recursive dependencies was overcomplicated
and only worked in the simple case of A → B → C → A and not
A → B → C → B. This new method works as follows:

- Given a dependency path…

  - Get all of the links in the last document in the path.

  - If there are no links, return the path.

  - If there are links which point to a file in the path, it is a
    recursive dependency. Return the path ending at the point of
    recursion.

  - Otherwise (there are nonrecursive links), process each path which
    results from appending each link to the end of the current path and
    return all of them.

The algorithm ends with a set of paths to leaf nodes in the dependency
tree, and each nonroot node in this tree (leaf or branch) is a
dependency. This is what the behaviour should have been from the
beginning. (The old method attempted to process the tree in layers,
rather than as a set of paths.)

5 weeks agoAllow including entire directories
Lady [Wed, 3 Jul 2024 01:10:31 +0000 (21:10 -0400)]
Allow including entire directories

This commit enables `@xlink:href`s pointing to entire directories
(ending in `/`) in `<书社:link>`s as an alias for providing a link to
each file in the directory individually. This was always planned, but
apparently never actually implemented before now.

5 weeks agoDo asset transforms during application
Lady [Sun, 30 Jun 2024 20:41:48 +0000 (16:41 -0400)]
Do asset transforms during application

It’s reasonable to expect ordinary transforms to create new
`<html:style>` and `<html:object>` elements, and these should be
handled as well.

8 weeks agoDisallow @xlink:actuate values other than none
Lady [Sat, 22 Jun 2024 22:07:50 +0000 (18:07 -0400)]
Disallow @xlink:actuate values other than none

This is for forward‐compatibility; future versions of ⛩📰 书社 will
likely define semantics for other `@xlink:actuate` values.

8 weeks agoProvide the location of parsed files in metadata
Lady [Sat, 22 Jun 2024 21:54:29 +0000 (17:54 -0400)]
Provide the location of parsed files in metadata

Rather than hardcoding parsed file lookup into `expandmetadata.xslt`
and `catalog2transform.xslt`, provide a file U·R·I for the parsed file
as a part of its metadata and use that instead. It _is_ reasonable for
transforms to want to access the original parsed documents of
dependencies. Note, however, that there is no guarantee that the parsed
document actually exists if it _isn’t_ a dependency for the file.

8 weeks agoDisable make·file prerequisites when not needed
Lady [Sat, 22 Jun 2024 21:43:40 +0000 (17:43 -0400)]
Disable make·file prerequisites when not needed

Specifically, the `help` and `clean` targets don’t require any
compilation of types, parsers, dependencies, or destinations. G·N·U
Make provides the `$(MAKECMDGOALS)` to check which targets were set as
goals on the commandline; when the only goals are `help` and `clean`,
excessive computation can be disabled.

8 weeks ago“Simplify” the restart mechanism using $?
Lady [Sat, 22 Jun 2024 20:06:53 +0000 (16:06 -0400)]
“Simplify” the restart mechanism using $?

Instead of having two GNUmakefile rules which are present under
different conditions (and which could hypothetically both apply), just
have one and check to see which prerequisites are out·of·date in order
to adjust the behaviour.

In order to prevent unnecessary builds of metadata and parsed files
prior to a type update, wrap the recipes in a check to see if
`$(BUILDDIR)/.update-types` was created over the course of the build.
This needs to happen in the shell, not in Make, because older versions
of Make cache the `$(wildcard)` function. The implementation of
`$(unlesstypeswillupdate)` uses an `if` function instead of a `and`
because the latter seems to trim white·space.

It is no longer an error if the type of a file cannot be determined;
this is required to enable recipe expansion when types are not yet
generated now that the test is happening in the shell. Instead, files
are given a default type of `application/octet-stream`.

8 weeks agoGenerate dependencies & destinations with metadata
Lady [Sat, 22 Jun 2024 17:02:24 +0000 (13:02 -0400)]
Generate dependencies & destinations with metadata

This commit obviates the need for separate `metadata2dependencies` and
`metadata2destinations` transforms and simply bundles their
functionality into `expandmetadata`.

Making this work right is a bit tricky because we are outputting the
main document to `stdout` but want the other result documents to be
output to `BUILDDIR`. The best solution would be to just read in the
build directory inside of the transform and use it to determine the
output location, but unfortunately `exsl:document` does not support
dynamic computation of the destination directory. The current solution
is instead to `cd` into the build directory in a subshell before
calling `xsltproc`.

8 weeks agoSimplify metadata using new 书社vocab terms
Lady [Sun, 2 Jun 2024 02:11:10 +0000 (22:11 -0400)]
Simplify metadata using new 书社vocab terms

This commit also changes the behaviour of `@书社:destination`:
Formerly, the value of this attribute needed to be a percent·encoded;
now, it must _not_ be percent·encoded.

8 weeks agoGenerate destinations and dependencies as metadata
Lady [Sun, 2 Jun 2024 01:31:55 +0000 (21:31 -0400)]
Generate destinations and dependencies as metadata

The format of this is subject to change. It might actually be desirable
to have the dependency and destination files be side·effects of the
metadata file generated alongside it (in the same `xsltproc` call)
rather than needing to generate them separately.

8 weeks agoDon’t allow xsltproc to output files
Lady [Mon, 27 May 2024 21:38:46 +0000 (17:38 -0400)]
Don’t allow xsltproc to output files

…with the exception of the archive extractor, which is
specially constructed to do so. In all other cases, just output to
standard output and pipe to a file as with other commands, for
consistency and security.

8 weeks agoProvide template identifiers as <书社:id>s
Lady [Mon, 27 May 2024 21:16:23 +0000 (17:16 -0400)]
Provide template identifiers as <书社:id>s

This is definitely going to break existing websites, but it’s much more
sensible and straightforward to deal with, in my opinion. Alternatives
included instead providing them as comments or processing instructions,
which would be much harder to process.

8 weeks agoDo not wrap results which contain no H·T·M·L
Lady [Mon, 27 May 2024 20:16:44 +0000 (16:16 -0400)]
Do not wrap results which contain no H·T·M·L

It’s much more likely that a result which is not H·T·M·L is intended to
remain that way; wrapping it in `<html:body>` can be used as a
work·around when H·T·M·L wrapping is desired.

8 weeks agoAdd nfo:fileName to file metadata
Lady [Mon, 27 May 2024 19:48:12 +0000 (15:48 -0400)]
Add nfo:fileName to file metadata

This is useful as `nfo:fileUrl` is percent‐encoded.

8 weeks agoSimplify 书社:literally transform output
Lady [Mon, 27 May 2024 19:46:56 +0000 (15:46 -0400)]
Simplify 书社:literally transform output

Use literal result elements and attributes in cases where it is safe to
do so.

8 weeks agoDrop apostrophe from ‹ Ladys ›
Lady [Mon, 27 May 2024 19:23:51 +0000 (15:23 -0400)]
Drop apostrophe from ‹ Ladys ›

8 weeks agoRemove variation selectors from sigil
Lady [Mon, 27 May 2024 19:09:44 +0000 (15:09 -0400)]
Remove variation selectors from sigil

The choice of whether to render a character as emoji style or text
style is properly a font and typesetting decision, not a character
encoding one. Altho Unicode provides variation selectors for indicating
a preference in plain text, these selectors should not be given formal
significance. To be clear that the canonical encoding for the sigil is
`<U+26E9,U+1F4F0>`, remove them across the board.

8 weeks agoSet locale and timezone and export them
Lady [Mon, 27 May 2024 18:50:22 +0000 (14:50 -0400)]
Set locale and timezone and export them

All programs should execute using (U·T·F 8) C strings and all times
should be in U·T·C.

8 weeks agoProvide metadata in transform; add attributes there
Lady [Wed, 22 May 2024 06:37:02 +0000 (02:37 -0400)]
Provide metadata in transform; add attributes there

The metadata actually depends on the parser, so it’s a recursive
dependency to make the parser use it. Instead, just make it available
in transforms and add the various ⛩️📰 书社 attributes during the
expansion phase.

Literally including the metadata R·D·F in the transform greatly
increases its file size, but it “should” be fine.

This commit also brings with it a few other improvements and changes to
transforms :⁠—

- All of the `$书社:*` variables which used to return result tree
    fragments now return node sets.

- The `书社:application` mode has been renamed to `书社:apply`, to
    match `书社:expand`.

8 weeks agoDrop CKSUM and SRCTIME params; add as attributes
Lady [Wed, 22 May 2024 05:21:45 +0000 (01:21 -0400)]
Drop CKSUM and SRCTIME params; add as attributes

`@书社:cksum`, `@书社:mtime`, and `@书社:identifier` are now all added
during the parsing phase. (`@书社:identifier` used to be added during
the transformation phase, but badly. `@书社:mtime` is new.)

This hardcodes the location of the metadata file for now; ideally the
metadata would be embedded.

8 weeks agoReplace source catalog with metadata file
Lady [Wed, 22 May 2024 04:44:49 +0000 (00:44 -0400)]
Replace source catalog with metadata file

There are two things which this approach should eventally bring :—

1. Availability of various aspects of file metadata for every file
   during the parsing and transformation phases. Right now, only
   metadata for the file currently being processed is available, and
   while loading the catalog is possible in transforms, it’s probably
   not really advisable and hasn’t been extensively tested.

2. Cacheing of file metadata for files which have not changed since the
   last time Make was run. This comes with the usual Make drawback that
   if a file is changed to be older, rather than newer, it won’t be
   recognized as having been changed.

Neither of these things are really implemented at this point, but the
metadata file is created and being used and the old catalog has been
removed. Future commits should refine the behaviour.

8 weeks agoGive magic file symlinks unique names 0.9.6
Lady [Thu, 11 Jul 2024 01:45:26 +0000 (21:45 -0400)]
Give magic file symlinks unique names

Rather than deal with the potential for conflicts in the names of magic
files from different sources, give each file a unique name by taking
the `cksum` of its absolute path.

8 weeks agoSupport multiple SRCDIR in INCLUDEDIR default
Lady [Thu, 11 Jul 2024 01:45:04 +0000 (21:45 -0400)]
Support multiple SRCDIR in INCLUDEDIR default

If multiple `SRCDIR`s are provided, the default `INCLUDEDIR` needs to
append `/includes` to each, not simply the last one.

8 weeks agoEliminate unnecessary use of cat
Lady [Sun, 7 Jul 2024 04:37:28 +0000 (00:37 -0400)]
Eliminate unnecessary use of cat

Input redirection works just as well here.

2 months agoSupport -exec in find 0.9.5
Lady [Sat, 6 Jul 2024 22:50:57 +0000 (18:50 -0400)]
Support -exec in find

`-print` is only implicitly added to `find` rules which do not contain
an `-exec`. The desired behaviour is that `-print` is called
regardless, with the assumption that `-exec` commands are always
silent.

2 months agoActually use FINDINCLUDERULES
Lady [Sat, 6 Jul 2024 20:42:47 +0000 (16:42 -0400)]
Actually use FINDINCLUDERULES

Commit d94cfdc987aba3983f4945d59b02cbb062573432 added this variable and
documented it, but strangely it was never actually used in the
appropriate place; `FINDRULES` was used instead for both ordinary
sources and includes.

2 months agoFix generator metadata
Lady [Sat, 22 Jun 2024 22:20:59 +0000 (18:20 -0400)]
Fix generator metadata

Formerly, existing generator metadata was preserved and also duplicated
in the tag added by ⛩📰 书社. It only makes sense to do one or the
other.

2 months agoDon’t recognize title metadata in templates
Lady [Sat, 22 Jun 2024 22:18:17 +0000 (18:18 -0400)]
Don’t recognize title metadata in templates

Per H·T·M·L, the elements in templates are _not_ children, and these
semantics should be respected for microdata.

2 months agoAllow overriding of finalization program 0.9.4
Lady [Sat, 22 Jun 2024 15:59:53 +0000 (11:59 -0400)]
Allow overriding of finalization program

2 months agoUse --nonet on xmllint, too
Lady [Sat, 22 Jun 2024 16:11:04 +0000 (12:11 -0400)]
Use --nonet on xmllint, too

This option was already being supplied for `xsltproc`. Networking
should always be disabled by default; mechanisms for selectively
enabling it may be added later.

2 months agoUse --noent when calling xmllint
Lady [Mon, 27 May 2024 18:41:47 +0000 (14:41 -0400)]
Use --noent when calling xmllint

The X·Path expressions do not correctly match text provided within
entities if the entities are not expanded. Adding `--noent` ensures
that all entities are expanded and X·Path works correctly.

3 months agoWrap EXTRAFINDRULES in parentheses 0.9.3
Lady [Sat, 25 May 2024 04:14:34 +0000 (00:14 -0400)]
Wrap EXTRAFINDRULES in parentheses

It shouldn’t be required that users do this.

3 months agoImprove SRCDIR/INCLUDEDIR handling; allow dot
Lady [Sat, 25 May 2024 04:08:01 +0000 (00:08 -0400)]
Improve SRCDIR/INCLUDEDIR handling; allow dot

- Explicitly allow `find` to match `.`, which otherwise would be
  excluded as a dotfile.

- Add special handling to drop the leading `./` that results from the
  above, and generate the appropriate local paths without needing it.

- Error when trying to perform certain transformations on file·names
  and failing, to better aid diagnosis.

- When a file has no destination (because `destinations` has not been
  generated yet), use the fake destination `NOTDEF`. (Make will restart
  before this destination is used.)

3 months agoINCLUDEDIR should default to be in SRCDIR
Lady [Sat, 25 May 2024 04:05:27 +0000 (00:05 -0400)]
INCLUDEDIR should default to be in SRCDIR

…not the literal value `sources`, regardless of what `SRCDIR` might
be.

3 months agoMark GNUmakefile as precious
Lady [Fri, 24 May 2024 05:10:58 +0000 (01:10 -0400)]
Mark GNUmakefile as precious

One would hope that Make wouldn’t ever delete the make·file it is
running, but the documentation doesn’t seem to explicitly give that
guarantee, so it’s good to be explicit about it.

3 months agoReformat redirections 0.9.2
Lady [Fri, 24 May 2024 03:21:50 +0000 (23:21 -0400)]
Reformat redirections

- Remove the space after, but not before redirection operators.

- Do `>>/dev/null` instead of `> /dev/null`; appending makes more
  logical sense in this case.

- Use `>|` for other outputs because this make·file should always
  clobber.

3 months agoImprove documentation regarding Posix utilities
Lady [Fri, 24 May 2024 02:09:26 +0000 (22:09 -0400)]
Improve documentation regarding Posix utilities

3 months agoSet .SHELLFLAGS to match Posix behaviour
Lady [Fri, 24 May 2024 03:43:06 +0000 (23:43 -0400)]
Set .SHELLFLAGS to match Posix behaviour

Early failure upon the failure of a command seems like a good thing??

3 months agoMove variable overrides before targets in submake
Lady [Fri, 24 May 2024 02:16:00 +0000 (22:16 -0400)]
Move variable overrides before targets in submake

It doesn’t matter, but this is the Posix ordering.

3 months agoUse exit with a nonzero exit status, not false
Lady [Fri, 24 May 2024 02:44:58 +0000 (22:44 -0400)]
Use exit with a nonzero exit status, not false

3 months agoUse colon (:), not true
Lady [Fri, 24 May 2024 02:43:09 +0000 (22:43 -0400)]
Use colon (:), not true

These are equivalent, but `:` is a special shell builtin and `true` is
not.

3 months agoAllow overriding of cd
Lady [Fri, 24 May 2024 02:39:49 +0000 (22:39 -0400)]
Allow overriding of cd

Altho `cd` is builtin in most shells, it is not a special builtin
utility as defined by Posix, and the use of an alternative
implementation is conceivable.

3 months agoPrepend X·M·L declaration on parsed assets 0.9.1
Lady [Wed, 22 May 2024 04:31:41 +0000 (00:31 -0400)]
Prepend X·M·L declaration on parsed assets

⛩️📰 书社 policy is to never omit it.

3 months agoFORCE on type updates
Lady [Wed, 22 May 2024 04:29:51 +0000 (00:29 -0400)]
FORCE on type updates

When this was originally implemented, I’m not sure `FORCE` was defined,
but it’s needed now for `diffprereqs` so there’s no reason why not to
use it here as well.

3 months agoFix typeoffile
Lady [Wed, 22 May 2024 04:26:34 +0000 (00:26 -0400)]
Fix typeoffile

The old implementation switched some things around and probably would
not work if called with multiple files (it never was).

3 months agoUse diff to get better dates
Lady [Tue, 21 May 2024 06:06:07 +0000 (02:06 -0400)]
Use diff to get better dates

See the comments for more information, including Macintosh quirks. This
is a great deal better than using `ls` and allows for the dropping of
the latter as a dependency.

3 months agoRedirect messages to stderr & support disabling 0.9.0
Lady [Tue, 21 May 2024 03:46:42 +0000 (23:46 -0400)]
Redirect messages to stderr & support disabling

This enables `make -s listout` to work as intended without need for
additional processing.

3 months agoSupport +xml suffix for determining X·M·L files
Lady [Tue, 21 May 2024 03:19:48 +0000 (23:19 -0400)]
Support +xml suffix for determining X·M·L files

This gets around operating system extensions to `file` which might
identify S·V·G files (for example) as `image/svg+xml` before
attempting magic detection. If not every X·M·L‐based syntax should be
handled as such by ⛩️📰 书社, redefine `XMLTYPES` to exclude the
`+xml`.

3 months agoRemove support for pagination
Lady [Sun, 19 May 2024 21:43:05 +0000 (17:43 -0400)]
Remove support for pagination

Expanded archives support this need better.

3 months agoRemove stat dependency
Lady [Sun, 19 May 2024 21:16:42 +0000 (17:16 -0400)]
Remove stat dependency

This is, strictly speaking, a downgrade in functionality, with the
upside of reducing reliance on non·Posix programs (namely `stat`). A
better, Posix‐compliant solution is to archive an empty file with the
correct modification time and then list out the time from that archive;
however, as far as I’m aware, it’s not possible to obtain an
implementation of the `pax` utility which actually supports this. macOS
only supports a very limited subset of the `listopt` option, and only
for pax archives (not tarballs); other implementations don’t seem to
support it at all.

3 months agoForce removal of existing directories 0.8.3
Lady [Sun, 19 May 2024 22:09:06 +0000 (18:09 -0400)]
Force removal of existing directories

…prior to processing results or installing. Mostly, this prevents a
failure when an expanded archive is changed to no longer be expanded.
This also simplifies the installation code a bit.

3 months agoFix base64 decoding
Lady [Sun, 19 May 2024 21:55:58 +0000 (17:55 -0400)]
Fix base64 decoding

The `tr -d` in this pipeline also removed the trailing newline, so it’s
necessary to re·add it prior to the closing equals.

3 months agoRemove sed range expressions
Lady [Sun, 19 May 2024 19:54:20 +0000 (15:54 -0400)]
Remove sed range expressions

These are technically only Posix in the Posix locale and have undefined
meaning otherwise. It’s not the policy of ⛩️📰 书社 to require the
Posix locale, so the safest thing is to just not use range expressions
here.

(Actually, this policy might be worth revisiting for things which
definitely need to be operating on Unicode text.)

4 months agoExplicitly declare ustar format to pax
Lady [Fri, 3 May 2024 04:19:46 +0000 (00:19 -0400)]
Explicitly declare ustar format to pax

In Posix, the default format for writing is implementation‐defined, but
⛩️📰 书社 is documented to always produce tarballs.

4 months agoUse compound commands to join strings, not sed 0.8.2
Lady [Fri, 3 May 2024 03:48:12 +0000 (23:48 -0400)]
Use compound commands to join strings, not sed

Previously, the script would sometimes use sed to insert text at the
beginning or end of a string, but it is better to just printf as a
separate step instead.

4 months agoRemove dependency on echo
Lady [Fri, 3 May 2024 03:19:01 +0000 (23:19 -0400)]
Remove dependency on echo

`printf` is always preferable to `echo` for portability reasons.

4 months agoSupport “expanded” archives
Lady [Fri, 3 May 2024 03:13:55 +0000 (23:13 -0400)]
Support “expanded” archives

The intent is for this mechanism, which is much simpler to implement,
to replace the pagination functionality which was recently added.

4 months agoFix base64 output 0.8.1
Lady [Thu, 2 May 2024 05:51:44 +0000 (01:51 -0400)]
Fix base64 output

Due to a typo, the `uuencode` trailer of four equals signs was being
appended to base64 outputs.

4 months agoImprove xargs handling
Lady [Thu, 2 May 2024 05:48:21 +0000 (01:48 -0400)]
Improve xargs handling

- Always specify -E '' to disable end‐of‐file handling

- Quote standard input before passing it thru to xargs, and eliminate
  usage of the nonstandard `-0` option

- Get rid of xargs where it isn’t strictly required, to avoid line
  length limits

4 months agoAdd @data-tsv-header to TSV data cells
Lady [Thu, 2 May 2024 03:05:51 +0000 (23:05 -0400)]
Add @data-tsv-header to TSV data cells

This produces pretty verbose output, but gzipping should be able to
significantly compress it as the attributes will be repeated verbatim
every row.

4 months agoUse -u option on date, instead of TZ=
Lady [Thu, 2 May 2024 02:20:40 +0000 (22:20 -0400)]
Use -u option on date, instead of TZ=

`-u` is a Posix option, so it’s safe to use.

4 months agoUpdate documentation regarding (non‐)Posix needs
Lady [Thu, 2 May 2024 02:14:51 +0000 (22:14 -0400)]
Update documentation regarding (non‐)Posix needs

4 months agoSupport pagination 0.8.0
Lady [Tue, 30 Apr 2024 07:53:58 +0000 (03:53 -0400)]
Support pagination

It’s not clear to me that this is actually a good idea, and this
functionality may be reverted later. It adds a lot of complexity
despite still having significant drawbacks, and the alternative pattern
of just generating archives and later expanding them is a much safer
and more versatile solution.

However, the pattern of e·g needing a paginated feed of all the posts
in one’s blog suggests that something along these lines (backed by this
method or archiving~expanding) *should* be supported by default in
⛩️📰 书社. One alternative might be to add (e·g) a `@书社:expand`
attribute to <书社:archive> elements, tho how exactly this would be
tracked on the resulting archives is unclear, and it would be
restricted to producing folders (with exclusively archive contents)
that could not easily be mixed with other files.

4 months agoUpdate readme
Lady [Tue, 30 Apr 2024 01:56:58 +0000 (21:56 -0400)]
Update readme

⛩️📰 is now tested on newer versions of Make, al·be·it not
particularly extensively.

4 months agoAdd listout target
Lady [Tue, 30 Apr 2024 01:53:06 +0000 (21:53 -0400)]
Add listout target

Useful for post·processing of files which were installed by ⛩️📰 书社.

Note: There will be plenty of other Make output; use the following to
get just the files :—

    make listout | sed '/^⛩️📰 书社 Output:/!d;s/^⛩️📰 书社 Output://'

4 months agoDon’t use xargs -J 0.7.4
Lady [Mon, 29 Apr 2024 03:18:59 +0000 (23:18 -0400)]
Don’t use xargs -J

It isn’t portable!

4 months agoUpdate documentation to reflect usage on Linux
Lady [Sun, 28 Apr 2024 18:44:55 +0000 (14:44 -0400)]
Update documentation to reflect usage on Linux

4 months agoMake base64 handling Posix
Lady [Sun, 28 Apr 2024 18:42:21 +0000 (14:42 -0400)]
Make base64 handling Posix

Posix doesn’t allow for a `-r` option on `uudecode` or `uuencode`, but
the headers and footers are easy enough to manually add and remove.

4 months agoFix T·S·V parser
Lady [Sun, 28 Apr 2024 18:06:18 +0000 (14:06 -0400)]
Fix T·S·V parser

A pair of mistakes meant that the final body column was dropped, and
would have been unprocessable if it wasn’t.

4 months agoTouch important files before making with xsltproc
Lady [Sun, 28 Apr 2024 04:02:37 +0000 (00:02 -0400)]
Touch important files before making with xsltproc

When there is nothing to output, `xsltproc` does not create files.
However, Make will find itself in an endless restart loop if these
files are never created.

4 months agoFix X·M·L 1.1 handling to be portable 0.7.3
Lady [Sun, 28 Apr 2024 03:46:11 +0000 (23:46 -0400)]
Fix X·M·L 1.1 handling to be portable

A typo meant it was calling `PRINTF` instead of `printf`; amazingly,
the built·in seems to be case‐insensitive on Macintosh so it wasn’t
noticed.

4 months agoDon’t allow network or DTD loading
Lady [Sun, 28 Apr 2024 03:06:06 +0000 (23:06 -0400)]
Don’t allow network or DTD loading

This still processes the internal DTD in a nonvalidating way.

Formerly, it would try to fetch the XML catalog DTD every time.

4 months agoSupport GNU stat
Lady [Sun, 28 Apr 2024 02:48:30 +0000 (22:48 -0400)]
Support GNU stat

`stat` isn’t at all portable; it’s necessary to just try to figure out
which version is being used and then handle each case accordingly.

4 months agoDon’t use <<<
Lady [Sun, 28 Apr 2024 02:46:39 +0000 (22:46 -0400)]
Don’t use <<<

This isn’t supported in Dash.

4 months agoAllow injecting raw output in X·M·L serialization 0.7.2
Lady [Sun, 14 Apr 2024 23:38:07 +0000 (19:38 -0400)]
Allow injecting raw output in X·M·L serialization

It’s not possible to serialize things like entities using the normal
X·S·L·T processes. With this commit, one can instead use something like
`<书社:raw-output>&amp;my-entity;</书社:raw-output>` inside of
`<书社:serialize-xml>` elements to get this result.

4 months agoAdd support for manually serializing X·M·L
Lady [Sun, 14 Apr 2024 19:44:22 +0000 (15:44 -0400)]
Add support for manually serializing X·M·L

This commit adds a transform for a new `<书社:serialize-xml>` element,
which is useful in conjunction with `<书社:raw-text>` to produce a more
finely‐controlled X·M·L output, or in other X·M·L‐y situations where an
escaped X·M·L value is required. The algorithm used for serialization
attempts to closely match the DOM Parsing and Serialization spec,
including such behaviours as mandating an undeclared `xml:` prefix for
the X·M·L name·space and dropping the prefix from elements whose
name·space matches the default, but it probably isn’t exactly the same
(due in part to the fact that the underlying data structure is an X·M·L
infoset, not a potentially dynamically‐modified Dom). No special
allowances are made for elements in the H·T·M·L name·space; this is not
(yet) a suitable polyglot serializer (or intended to be one).

4 months agoMake <书社:raw-text> a C·data section element 0.7.1
Lady [Thu, 11 Apr 2024 16:58:00 +0000 (12:58 -0400)]
Make <书社:raw-text> a C·data section element

4 months agoDisallow archive paths beginning with `/`
Lady [Thu, 11 Apr 2024 16:57:12 +0000 (12:57 -0400)]
Disallow archive paths beginning with `/`

This would have resulted in final paths starting with `.//`, which,
while probably mostly harmless, is definitely weird.

4 months agoAllow creation of tarballs 0.7.0
Lady [Wed, 10 Apr 2024 19:53:11 +0000 (15:53 -0400)]
Allow creation of tarballs

This is useful when using ⛩️📰 书社 directly as a static site
generator to provide archive downloads (archives are not compressed; it
is assumed that they will be gzipped over the wire). This requires
a recursive call to Make for each archive file, which performs the
following steps :—

- Extracts all of the elements slated for archiving into separate
  files.

- Restarts.

- Processes the resulting extracted files and then archives them.

The extraction step in particular is somewhat convoluted; it requires
dynamically generating a transform which has the appropriate
`<exsl:document>` elements for a given source file, and then applying
that transform in a second call to `xsltproc`.

X·M·L outputs are now passed through an extra call to `xmllint` to
remove any unnecessary namespace attributes instead of just symlinked;
the symlinks weren’t compatible with archiving anyway.

5 months agoUse @extension-element-prefixes to exclude E·X·S·L
Lady [Tue, 2 Apr 2024 01:46:47 +0000 (21:46 -0400)]
Use @extension-element-prefixes to exclude E·X·S·L

This follows the recommendations on the website and enables the use of
E·X·S·L extension elements in addition to the extension functions.

5 months agoDon’t “compile” assets, just “build”
Lady [Mon, 1 Apr 2024 23:38:48 +0000 (19:38 -0400)]
Don’t “compile” assets, just “build”

This reserves the `build/results/` directory for _just_ the results of
transformations, and delays the copying of asset files into the build
directory until the actual “build” step. (Likewise for recursive files,
altho these still just error).

`make all` now builds all installable files, including assets, which
were formerly excluded. A downstream script might expect assets to
appear in `build/public` after a `make all` and shouldn’t require a
`make install` to get them.

5 months agoAllow ⛩️📰 书社 to produce plain text
Lady [Mon, 1 Apr 2024 21:05:41 +0000 (17:05 -0400)]
Allow ⛩️📰 书社 to produce plain text

This requires adding _another_ build stage; the result of the
transformation step is output to `build/results`, which is then
processed again to create the `build/public` final result. In most
cases, this additional processing just produces a symlink. However,
when the root element is a special value, a derived file will be
produced.

The only special elements supported right now are `<书社:raw-text>`,
which outputs the raw text contents of the text nodes in the result
tree, and `<书社:base64-binary>`, which produces a binary file from the
base64 text contents determined using the same method.

5 months agoMake REUSE‐compliant
Lady [Mon, 1 Apr 2024 21:55:33 +0000 (17:55 -0400)]
Make REUSE‐compliant

5 months agoImprove (fix) the T·S·V parser
Lady [Mon, 1 Apr 2024 20:45:42 +0000 (16:45 -0400)]
Improve (fix) the T·S·V parser

Although `exslstr:tokenize()` is fast, it should not be used when
splitting the columns of a T·S·V file, as it will collapse empty
columns. Introduce a new transform in `lib/` for splitting, and import
it into the T·S·V parser.

This transform was largely copied from Caudex
<https://git.ladys.computer/Caudex/blob/0.1.1:/lib/split.xslt> and is
likely to be useful downstream as well.

Continue using `exslstr:tokenize()` for splitting the _rows_ of the
T·S·V, as empty rows _should_ be collapsed.

5 months agoImprove the implementation of wrapplaintext 0.6.2
Lady [Thu, 28 Mar 2024 03:04:05 +0000 (23:04 -0400)]
Improve the implementation of wrapplaintext

- Use `printf` and octal escapes instead of hexadecimal ones, as they
  are more portable.

- Use `xargs` and piping to compose the wrapper and its contents,
  rather than a subcommand.

5 months ago“Support” X·M·L 1.1 0.6.1
Lady [Wed, 27 Mar 2024 04:09:27 +0000 (00:09 -0400)]
“Support” X·M·L 1.1

The X·M·L 1.1 “support” amounts to deleting the declaration and
replacing any character escapes for C·0 controls with
`U+0091 PRIVATE USE ONE`, which is a valid character in X·M·L 1.0.
This is done entirely in `sed`, so it’s not perfect, but it should be
“good enough”.

5 months agoCorrect syntax for X·Path booleans
Lady [Wed, 27 Mar 2024 03:57:31 +0000 (23:57 -0400)]
Correct syntax for X·Path booleans

The correct syntax is `true()` and `false()`; `true` and `false` refer
to elements with those names.

6 months agoRefactor transforms & add 书社:application stage 0.6.0
Lady [Thu, 8 Feb 2024 03:41:33 +0000 (22:41 -0500)]
Refactor transforms & add 书社:application stage

The main goal of this commit was to add a
`<书社:apply-attributes-to-root>` element, to allow transforms to pass
attributes up to the root element of the result, for example `@lang`
information. This required an extensive refactor of a lot of the
transform infrastructure and the creation of a new transform stage,
`书社:application`, which follows the ordinary transform and solely
handles `<书社:apply-attributes-to-root>` and
`<书社:apply-attributes>`. Other `@书社:*` attributes are removed at
this stage, but it isn’t generally recommended that transforms try to
hook in here.

This commit also makes a number of smaller changes :⁠—

- Use `node()` in place of element wildcards anywhere where
  specifically only matching elements wasn’t intended.

  In particular, even in places where text is not expected, there may
  be comments to preserve.

- Only add `@itemscope` and `@itemtype` attributes to H·T·M·L elements,
  since they are only defined for elements in that namespace.

- Provide `@书社:identifier` on documents and embeds to get the
  `about:shushe` u·r·i of the resource.

- In transforms which generate transforms, `<xsla:text>` elements which
  provide only white·space need `<xslt:text>` children to ensure the
  whitespace isn’t stripped. (Note: In the actual source text, `xsla:`
  is given the `xslt:` prefix and `xslt:` is the default prefix.)
  Similarly, it’s necessary to provide attribute value templates using
  a `<xslt:attribute>` element rather than with the literal result
  element syntax, to prevent them from being prematurely applied.

7 months agoReplace GENERATOR and VERSION with THISREV
Lady [Tue, 6 Feb 2024 03:56:03 +0000 (22:56 -0500)]
Replace GENERATOR and VERSION with THISREV

Instead of replacing existing `<html:meta name="generator">`s, format
them into a comma‐separated list with ⛩️📰 书社 as the final entry.
Don’t allow overriding of ⛩️📰 书社 generator metadata.

Manually specifying `THISREV` is still possible to allow it to be
filled by users running Make without Git, but it should not be
overridden with the version of the calling generator, as it is used to
fill `@书社:version`.

7 months agoUpdate parser documentation
Lady [Sun, 4 Feb 2024 22:36:46 +0000 (17:36 -0500)]
Update parser documentation

- Remove class names which are no longer provided from description.

- Document attributes added during parsing.

7 months agoDon’t add attributes to non·elements in parser
Lady [Sun, 4 Feb 2024 21:54:35 +0000 (16:54 -0500)]
Don’t add attributes to non·elements in parser

Check to see if it is an element first with `self::*`.

7 months agoAdd @书社:media-type to parsed nodes
Lady [Sun, 4 Feb 2024 21:49:01 +0000 (16:49 -0500)]
Add @书社:media-type to parsed nodes

Only keep the outermost media type, however (`@书社:parsed-by` records
all parsers).

7 months agoTrack catalog & magic prereqs and diff for changes 0.5.3
Lady [Sun, 4 Feb 2024 05:11:06 +0000 (00:11 -0500)]
Track catalog & magic prereqs and diff for changes

If a new prerequisite for a catalog (or the compiled magic file) is
added, and it is newer than the last build, then the catalog (or
compiled magic file) will be rebuilt. However, formerly, the file would
not be rebuilt if the added file was older, or if a prerequisite was
removed instead of added, due to limitations in Make.

This commit tracks the list of prerequisites separately, and if it
changes, forces a rebuild of the file regardless of whether the
prerequisites are newer or older than the target.

This page took 0.154631 seconds and 4 git commands to generate.