If condition to choose full date (dmy) or just the year (y)

I am trying to build a CSL style for the Argentinean legal community (I know Juris-M, but I am opting for a CSL file because I use pandoc > biblatex > latex to work, and Juris-M works with citeproc-js instead of pandoc-citeproc).

I am facing an issue, however, with an IF CONDITION to print it one way if the variable "number" is present and ELSE if the value is absent. The strange thing is the following: it does work with my workflow (pandoc > biblatex > latex > pdf), and it works in the [visual editor](https://editor.citationstyles.org/visualEditor/). But it does not work in Zotero.

1. Any idea why that might be the case?
2. Is there a better alternative to achieve this result than using an IF CONDITION that depends on the presence / absence of a variable? (it is sort of a rough hack)
  • The relevant code is the following:



    <choose>
    <if match="all" variable="number">
    <date form="text" variable="issued" text-case="sentence" prefix=". Sentencia del ">
    <date-part name="year" text-case="lowercase"/>
    </date>
    </if>
    <else>
    <date date-parts="year" form="numeric" variable="issued" prefix=" (" suffix=")"/>
    </else>
    </choose>

  • You seem to have a few misunderstandings. Pandoc has nothing to do with BibLaTeX. Pandoc-citeproc does not use BibLaTeX at all. When pandoc-citeproc formats citations, it does this entirely before converting to TeX or PDF. BibLaTeX is never invoked. If there are differences in the behavior of citeproc-js and pandoc-citeproc, that would generally be due to citeproc-js having an expanded feature set for legal citations not yet implemented in pandoc-citeproc.

    With that said, I’m not following what your specific problem is. “number” is available in all CSL styles and processors.

    What style are you using? Can you provide your style and the exact citation data you are using? What output are you getting in Zotero and in pandoc?
  • Yes, thanks! I explained my workflow in a sloppy way (I do understand better now the difference between citeproc-js and pandoc-citeproc). I am working on developing a new style based on Spanish-Legal.

    It's still being developed, but the CSL file is now on https://github.com/ramiroau/gacl

    I met a challenge I cannot solve.

    I would like to distinguish the way the date of judicial decisions is presented, depending of the presence of a Docket Number in the Zotero item / CSL JSON item / .bib file.

    In cases where the number is present, I would like the date to be presented in full and with "Sentencia del" as preffix:

    Sentencia del 10 de mayo de 2020.

    When the number is absent, I would like the date to include only the year, between brackets.

    (2020).

    I have managed to achieve this through a conditional in the visual editor. Relevant code between lines 249-262 (I am pasting this snippet below). Now the point where I am stuck:

    1. The code works as expected in the CSL visual editor.
    2. The code works as expected using Pandoc processing from a bib file.
    3. The code **does not work as expected** in the Zotero connector for Libre Office and/or Word.

    In the latter case (3), when number is present the date should be printed (2020) but instead it is printed Sentencia del 2020. I hope this explains



    <choose>
    <if match="all" variable="number">
    <date form="text" variable="issued" text-case="sentence" prefix=". Sentencia del ">
    <date-part name="day" range-delimiter="" text-case="lowercase"/>
    <date-part name="month" range-delimiter=""/>
    <date-part name="year" range-delimiter=""/>
    </date>
    </if>
    <else>
    <date date-parts="year" form="numeric" variable="issued" prefix=" (" suffix=")">
    <date-part name="year"/>
    </date>
    </else>
    </choose>



    Example of citation data (in CSL JSON)



    [
    {
    "id": "csjn2018d",
    "type": "legal_case",
    "authority": "Corte Suprema de Justicia de la Nación",
    "title": "Gómez, Lucila Nélida s/ amparo",
    "title-short": "CSJN",
    "author": [
    {
    "literal": "CSJN"
    }
    ],
    "issued": {
    "date-parts": [
    [
    "2018",
    11,
    13
    ]
    ]
    }
    }
    ]




  • Have you tried without
    <date-part name="year"/>
    </date>
    ?
    While technically valid, there's almost never a reason to include the date-part on a localized date and it's so rare that it's possible it triggers a bug on the affixes.
  • Thanks Adam --- I tried but the error remains. After discussing with some collegues, I've decided to move away from the different date format I was thinking of (probably a good substantive choice anyway). As to the technical error, my guess is that it has to do with the Zotero connector with word-processors, for the Code works in the Visual Editor and using pandoc. Thanks for your feedback on this topic.
  • The visual editor and Zotero in Word use the same processor, so I'm suspecting something else is going on, but probably not worth troubleshooting if you're not going to use it.
Sign In or Register to comment.