Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Space preceding DOI is linked when prefixed by CSL #163

Closed
adunning opened this issue Aug 31, 2015 · 6 comments
Closed

Space preceding DOI is linked when prefixed by CSL #163

adunning opened this issue Aug 31, 2015 · 6 comments

Comments

@adunning
Copy link
Contributor

Using pandoc-citeproc 0.7.3 and pandoc 1.15.0.6, a space preceding the linked DOI is linked when it is prefixed by the CSL, as with MHRA:

pandoc --csl=modern-humanities-research-association.csl -F pandoc-citeproc << EOT
> ---
> references:
> - id: test
>   DOI: 10.1484/J.RB.5.100519
> ...
> 
> @test
> 
> EOT

Result:

<p><span class="citation"><a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></span></p>
<div class="references">
<div id="ref-test">
<p><a href="http://doi.org/10.1484/J.RB.5.100519"> &lt;http://dx.doi.org/10.1484/J.RB.5.100519&gt;</a></p>
</div>
</div>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p><a href="http://doi.org/10.1484/J.RB.5.100519"> &lt;http://dx.doi.org/10.1484/J.RB.5.100519&gt;</a>. <a href="#fnref1"></a></p></li>
</ol>
</div>
@adunning
Copy link
Contributor Author

(This results, of course, from #107; sorry for not pointing this out earlier.)

@jgm
Copy link
Owner

jgm commented Sep 10, 2015

This is because the style has

            <text variable="URL" prefix=" &lt;" suffix="&gt;"/>

What fix do you propose? I suppose we could strip off leading spaces from the prefix and trailing spaces from the suffix, and put those outside the link.

For reference, here's a link to the relevant code:
d952693

@adunning
Copy link
Contributor Author

Exactly (technically line 405 is what we're looking at). It's not considered good style in CSL, but it happens frequently in practice.

Excluding the space from the link seems safe. Here, it would probably be better if < and > were not linked either, but that might be making things too complex.

@jgm
Copy link
Owner

jgm commented Sep 10, 2015

So maybe it would be best, instead of linking the prefix and suffix, just to check the prefix. If it ends with a string beginning http:, then the ending part is stripped off and added to the URL, which is linked. The rest of the prefix and suffix are not linked.

@adunning
Copy link
Contributor Author

Yes, that does sound more ideal. This would also return the old behaviour of not linking the prefixed doi: in Chicago, which personally I found more aesthetically pleasing.

@jgm jgm closed this as completed in a1e3f81 Sep 18, 2015
@adunning
Copy link
Contributor Author

That's even more clever. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants