public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* HTML Writer / Support CSL Recommendation for Linked Titles
@ 2021-08-11 15:55 Benjamin Bray
       [not found] ` <1370960d-9f5f-4da0-8078-741ac861c3fbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Bray @ 2021-08-11 15:55 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2256 bytes --]

The CSL specification has a recommendation for automatically linking titles 
<https://github.com/citation-style-language/documentation/blob/master/specification.rst#appendix-vi-links> 
when the citation style does not explicitly render the URL.  See also this discussion 
on GitHub 
<https://github.com/citation-style-language/documentation/issues/76>.

How hard would it be for Pandoc to support this recommendation, at least in 
the HTML writer?  Would this be a desirable change?  

I poked a round a bit in the source (for instance here 
<https://github.com/jgm/pandoc/blob/407de98b5e3971c84c7e89de5f2a9d317b4d4557/src/Text/Pandoc/Writers/HTML.hs#L813-L853>), 
but it wasn't clear to me where I might hook in to add this functionality.  
Pointers to the correct location would be appreciated!  I might be able to 
put together a PR.

My use case is Hakyll, where I want to use Pandoc to generate a 
bibliography, but I want a hyperlinked title instead of raw URLs.  I could 
hack something together to modify the HTML manually, but since there's an 
official CSL recommendation, it might be a nice feature to have in Pandoc 
itself.

Thanks,
Ben

_____

For reference, here is a snippet of the mentioned spec:

If the bibliography entry for an item does not render any of the above 
identifiers (doi,pmcid,pmid,url), then set the anchor of the link as the 
item title. If title is not rendered, then set the anchor of the link as 
the full bibliography entry for the item. Set the target of the link as one 
of the following, in order of priority:

   1. doi: prepend with "https://doi.org/"
   2. pmcid: prepend with "https://www.ncbi.nlm.nih.gov/pmc/articles/"
   3. pmid: prepend with "https://www.ncbi.nlm.nih.gov/pubmed/"
   4. url: output as is

If the item data does not include any of the above identifiers, do not 
include a link.


-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1370960d-9f5f-4da0-8078-741ac861c3fbn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3238 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 15:55 HTML Writer / Support CSL Recommendation for Linked Titles Benjamin Bray
     [not found] ` <1370960d-9f5f-4da0-8078-741ac861c3fbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-11 16:15   ` John MacFarlane
     [not found]     ` <m2v94c6jqv.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-08-11 16:39       ` Benjamin Bray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).