pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Add a data-description attribute to html elements

Open jjrsylvestre opened this issue 2 years ago • 4 comments

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" ... >

jjrsylvestre avatar Jun 24 '22 14:06 jjrsylvestre

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)?

rbeezer avatar Jul 03 '22 01:07 rbeezer

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.

jjrsylvestre avatar Jul 03 '22 02:07 jjrsylvestre

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?

rbeezer avatar Jul 06 '22 03:07 rbeezer

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.

jjrsylvestre avatar Jul 07 '22 18:07 jjrsylvestre