From: Lady Date: Sun, 27 Apr 2025 04:31:53 +0000 (-0400) Subject: Support attributes X-Git-Tag: 0.5.0~4 X-Git-Url: https://git.ladys.computer/LesML/commitdiff_plain/9d9f801071766e03c98ca919461855ff97ff5795 Support attributes This required a reworking of the link parsing code to enable it to also be used for attribute parsing (more‐or‐less), and maybe also fixed a bug where, if there was an end token with no start token, no further end tokens would be processed (even later ones they did have start tokens). --- diff --git a/README.markdown b/README.markdown index 327f253..11c8c37 100644 --- a/README.markdown +++ b/README.markdown @@ -193,6 +193,16 @@ Markup within paragraphs is delimited with·out exception by pairs of (consisting of `U+034F COMBINING GRAPHEME JOINER` for X·M·L compatibility). +- The characters `{@` and `"}` indicate attribute specifications. + The attribute specification must contain at least one `="` which + separates the key of the attribute from the value. + Attributes attach to the previous element or text node, with + white·space‐only text nodes after elements ignored; if there is no + such previous element or text node, an empty text node is used + instead. + Multiple attributes can be given in sequence. + Text nodes with attributes are wrapped in ``. + - The characters `{🔗` and `>}` indicate a hyperlink to a U·R·L (``). The hyperlink must contain at least one `<`; the content before the @@ -251,7 +261,9 @@ Finally, any character can be escaped by instead providing its Unicode codepoint in the form `{U+NNNN}`, where `NNNN` is one or more hexadecimal digits. Multiple codepoints may be provided separated by periods, as in - `{U+WWWW.ZZZZ}` + `{U+WWWW.ZZZZ}`. +Due to limitations in X·S·L·T, characters cannot be escaped in + attributes (including link targets). ## Usage diff --git a/parser.xslt b/parser.xslt index 7e6f6a3..f6b3823 100644 --- a/parser.xslt +++ b/parser.xslt @@ -12,6 +12,7 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v 2 If a copy of the M·P·L was not distributed with this file, You can obtain one at . --> @@ -21,12 +22,13 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:LesML="urn:fdc:ladys.computer:20240512:LesML" xmlns:exsl="http://exslt.org/common" + xmlns:exsldyn="http://exslt.org/dynamic" xmlns:exslset="http://exslt.org/sets" xmlns:exslstr="http://exslt.org/strings" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4" exclude-result-prefixes="LesML" - extension-element-prefixes="exsl exslstr" + extension-element-prefixes="exsl exsldyn exslset exslstr" version="1.0" > <书社:id>urn:fdc:ladys.computer:20240512:LesML:parser.xslt @@ -645,6 +647,28 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one + +