Remove period after URL

Hi,

I am customising an existing csl file, below is an example journal article reference.

SPAAK, Claude Vishnu, « Chapitre 1. Le primat de la forme (μορφή/εἶδος) dans l’interprétation heideggérienne de la Physique d’Aristote », dans Interprétations phénoménologiques de la « Physique » d’Aristote chez Heidegger et Patočka, 2017, coll. « Phaenomenologica », p. 173-243, http://dx.doi.org/10.1007/978-3-319-56544-6_4.

It all looks good, but I want to remove the final period, but only if the reference finishes with a url. So the above would become:

SPAAK, Claude Vishnu, « Chapitre 1. Le primat de la forme (μορφή/εἶδος) dans l’interprétation heideggérienne de la Physique d’Aristote », dans Interprétations phénoménologiques de la « Physique » d’Aristote chez Heidegger et Patočka, 2017, coll. « Phaenomenologica », p. 173-243, http://dx.doi.org/10.1007/978-3-319-56544-6_4

But other references which don't end in a url would maintain the final period, e.g.:

BEAULIEU, Alain, « Sous la protection de Sa Majesté. La signification de la Conquête pour les Autochtones », dans Sophie Imbeault, Denis Vaugeois et Laurent Veyssière (dir.), 1763 : le Traité de Paris bouleverse l’Amérique, Québec, Septentrion, 2013, p. 278‑301.

Here are my full code : https://pastebin.com/qZha5TXt

Any advice would be much appreciated. Thanks in advance!

PS : It is the same problem than another post here : https://forums.zotero.org/discussion/106948/remove-period-after-url

But my coding is different. Because I'm not fluent in english, I took this post and modified it to explain my issue...

  • This very specific set up is actually kind of tricky to do. I think the easiest way to do it is to define the period in the URL macro, so rewrite that as


    <macro name="URL">
    <choose>
    <if variable="URL">
    <text variable="URL" prefix=", "/>
    </if>
    <else>
    <text value="."/>
    </else>
    </choose>
    </macro>


    And then switch the <text macro="URL"/> with the </group> tag that follows it every time it appears, so for the bibliography, in line 582/583, 592/593, etc. and similarly for the citations. You'll also need to remove the suffix="." from both layouts.

    @damnation -- is there an easier solution without text value that I'm overlooking?
  • I usually remove the suffix set on "layout", then put everything in a group and set the suffix there and leave the URL macro outside of that group. In this case it's a lot of work though if one doesn't know CSL that well.
  • Right, that's what I would usually do and I don't think it's that hard to explain, but here, the delimiter between URL and rest should be a comma, but absent the URL it should end in a period. If you set suffix="." on the group without the URL you either get a period before the URL or you get ., if you set a comma prefix on the URL or wrap another group with a comma delimiter around it.
  • Thank you for your responses! I will try to apply your solution. Best regards
  • It is working, thank you. I had to teak a little bit the code to to avoid having two periods in a row when the reference ends with "34 p." or "6 vol." for example.
Sign In or Register to comment.