Open danmackinlay opened 4 years ago
Hey guess what, citeproc-rs already has its own version of wrap_url_and_doi
! It has a number of shortfalls, and it frankly shouldn't be enabled by default given the state of it:
So it's not done in any sense of the word. But if you put a very simple link in there it will get an anchor tag around it in HTML, and the affixes work correctly so \<https://google.com> renders correctly.
For reference, the code is roughly in these, three, places
The definition of InlineElement::Anchor
with children being nodes rather than a string means it's very easy to support wrapping other output like affixes etc, but I would prefer to avoid adding a feature like this:
<group urlwrap="DOI">
<text value="doi:" />
<text variable="DOI" />
</group>
(Output is doi:12345 as opposed to doi:12345.)
Why? Because groups being implicit conditionals means you need to change the definition of an intermediate group, and then add hyperlinks when flattening those groups later. Keeping that inside the <text>
element keeps the hyperlinking from being another 'deferred' attribute. That could look like this:
<text url="DOI" include-affixes="true" prefix="doi:" />
text url
could be another variant of text variable/value/macro
etc. <text variable="title" url="DOI">
for wrappping another variable. I would be cool with that.
As per the suggestion there, this issue is cloned from a citeproc-js issue: