CSL Month / Date Month

edited November 10, 2019
Hey, I rewrote an APA-code, so it suits for my University.

I have one Problem left: I need a way to get the following:
If there is a date with month:
Muster, M. (1996, 21. Mai). Titel Magazinartikel. Publikation, S. 12-13.
If there is only a month:
Muster, M. (1996, Mai). Titel Magazinartikel. Publikation, S. 12-13.

The first one is correct, with the second one I get:
Muster, M. (1996. Mai). Titel Magazinartikel. Publikation, S. 12-13.

I know I need to tell the Programm: if there is no date -> do this
But I'm no programmer, so I and 100 other students would be super happy for your help :)

This is my code:
  • edited November 10, 2019
    Sry, it was not displayed as desired…
    All lines that stop with >, begin with <

    macro name="issued">
    choose>
    if type="bill legal_case legislation" match="any"/>
    else-if variable="issued">
    group>
    date variable="issued">
    date-part name="year"/>
    /date>
    text variable="year-suffix"/>
    choose>
    if type="article article-magazine article-newspaper broadcast interview pamphlet personal_communication post post-weblog treaty webpage" match="any">
    date variable="issued">
    date-part prefix=", " name="day"/>
    date-part prefix=". " name="month"/>
    /date>
    /if>
    !-- Only year: article-journal chapter entry entry-dictionary entry-encyclopedia dataset figure graphic motion_picture manuscript map musical_score paper-conference patent report review review-book song speech thesis -->
    /choose>
    /group>
    /else-if>
    else-if variable="status">
    group>
    text variable="status" text-case="lowercase"/>
    text variable="year-suffix" prefix="-"/>
    /group>
    /else-if>
    else>
    group>
    text term="no date" form="short"/>
    text variable="year-suffix" prefix="-"/>
    /group>
    /else>
    /choose>
    /macro>
  • Or is there a citation-style that already works this way? So I could include the code
  • The conditional to print "no date" or the "date" would look like this in it's minimal form:

    <macro name="date">
    <choose>
    <if match="any" is-uncertain-date="issued">
    <text term="no date"/>
    </if>
    <else>
    <date variable="issued">
    <date-part name="year"/>
    </date>
    </else>
    </choose>
    </macro>


    Adapt as necessary.
  • Thank you for your answer!

    Where do I need to add this? So far it hasn't changed anything when I tried. I also didn't find any hints in the forum how to do it...
  • edited December 16, 2019
    I gave you an example how this could be implemented in its minimal form.
    You can see a real example here. Lines 171... https://github.com/citation-style-language/styles/blob/master/academy-of-management-review.csl

    It all depends on the style you use. We'd need to see that to give better advice. You can upload your code to a code sharing tool like hastebin or pastebin and share the link here.
Sign In or Register to comment.