pretext
pretext copied to clipboard
Add a data-description attribute to html elements
Rather than trying to kludge around all the special cases in the javascript when creating well-crafted link text for the copy-on-click rich-text for permalinks, it would be nice if PreTeXt provided this information in the html output on every element.
Example:
<section class="section" id="section-systems-examples" ... data-description="Section 1.4 Examples" ... >
A bit of a rat's nest to figure out just where this all needs to go. :-(
Searching the code for HTML section
, article
, figure
, p
would catch a lot of uses. Maybe li
too. Can you think of what I might be forgetting? Will it be easy enough for you to stumble on places where they might be missing? (In other words, will iterating to full coverage be easy enough?)
We have a PreteXt description
element, which may see some changes in how it is realized in HTML. Would some thing like data-permalink-text
or just data-link-text
be workable (and maybe more ... descriptive)?
Either data-permalink-text
or data-link-text
works for me.
As a first pass:
- anything that gets a
<h* class="heading">
child - anything that gets a
<figcaption>
child - some special cases:
assemblage
,p
, bib items
Don't think we're putting permalinks on any li
elements currently.
I'm a little concered about content (a "formatted" title) ending up in attribute (metadata). We have a title-plain
modal template that could be used, but I might make it even harsher - any unanticipated markup in a title just gets dropped. If it gets noticed, we can deal with each new element as we go?
Maybe the manifest is a better place for this information. Manifest entries could be tied to html elements via some sort of key/hash that gets attached to html elements using a data-manifest-key
attribute. Or something.