-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preserve xhtml:attrs in XSLT #2166
preserve xhtml:attrs in XSLT #2166
Conversation
I should also mention that the master branch currently uses the <div class="ltx_block" data-xhtml-aria-label="sample-value">...</div> |
Unfortunately, you've caught me in a mood quite resistant to adding open-ended but special-purpose backdoors. They tend to make future development, testing, refactoring and cleanup very difficult because you never know how they've been used; you can't change anything. And additionally, when the original "feature" does get implemented, you've got two incompatible ways of doing the same thing. If I were inclined to go in this direction, I'd be thinking (since I do not approach things "html-centric"), that if the attribute's namespace is the same as the target namespace (whether xhtml, jats, whatever), you might simply copy the attribute w/o the namespace. Ah, but what if you did want the attribute namespaced? Which applies for xhtml as well, however unlikely that may seem at this particular moment. OTOH, if accessibility is the objective, we should probably spend some time thinking about how to do that correctly, but pragmatically. Will we ever have more than a "description" of an object coming from our source documents? Do we need aria in all its full glory to make use of that description? That is, we probably will place the description into html using some set of aria attributes, but does LaTeXML's XML need aria to do that? Or is an appropriately placed |
A technical note I noticed this morning, this kind of experimentation is already possible if it is done only as HTML, without inter-operating with the native schema. Namely this: DefEnvironment("{ariadiv}{}{}", "<ltx:rawhtml><xhtml:div aria-label='#1' aria-description='#2'>#body</xhtml:div></ltx:rawhtml>"); gets successfully carried into (X)HTML, thanks to the recently fixed #2148. |
Given that OTOH, since we've introduced a Special |
Most of this sounds like a code smell to me. Of course courtesy of XML's design which makes the simple and intuitive way of annotating something adjacent to "rude surprises", rather than helpful intuitive behavior. Irrespective of this PR, LaTeXML should be able to pass along any But I think there is more important work than this for now, closing here. |
Irrespective of this PR, LaTeXML should be able to pass along any
|xhtml:| namespaced attribute into HTML5, which it currently mangles,
No, since you have `USE_DATA_ATTRIBUTES` true, it did exactly what you
told it to do.
If, on the other hand, you want the ability to say that some attributes
(or namespaces) get turned into data attributes, some keep their
namespace, some drop their namespace, etc, etc, then you've got to have
a mechanism to specify what you want, without too many short signed
assumptions.
|
This is a PR-shaped question to @brucemiller, while brainstorming on #2165 .
It is generally quite simple to write a small binding that deposits ARIA attributes for latexml, except that those attributes are not declared in the schema, and aren't allowed to pass through in the XSLT post-processing.
We could allow each and every one of the list of ARIA attributes in the
ltx
namespace, but - in purely pragmatic terms - such a requirement limits experimentation for lay binding authors a bit. I myself find it somewhat uncomfortable to be buffered through the latexml schema, before being able to experiment with emitting the ultimate HTML markup. Going back to enhance the schema after a stable HTML markup pattern emerges feels slightly more natural to exploratory coding.The PR contains the first quick upgrade while wearing my HTML hat - allow any
xhtml:attribute
to pass through the XSLT as a plainattribute
in the final (X)HTML, in the same conditional check that currently emitsdata-
attributes as a fallback.This allowed to write the binding:
author:
and emit to HTML5:
More generally, passing arbitrary
xhtml:names
along allows direct experimentation with (X)HTML attributes of any variety, bypassing that aspect of latexml's schema.In addition, maybe in a next PR (or next commit), if one was to be Principled in the XML sense, we'd follow the WAI-ARIA host languages instructions and declare an
aria
namespace at the official URIhttp://www.w3.org/ns/wai-aria
. Then I'd need a dedicated XSLT rule that mapsaria:
namespaced values intoaria-
values in HTML5, as we do fordata-
.I believe this simplest PR can be useful for general quick experimentation, and I can bring along the namespaced aria approach in addition to that.
How much of that aligns with your perspective here @brucemiller ?