Problems CMoS german mod (prefix space & date month short)

I know HTML and for a private historical project I am actually
trying (for the first time) to modify the CSL-style CMoS - Chicago
Manual of Style (Note with Bibliography).

First steps are done and something seems to work. But i run into
problems with 2 desired outputs:


  • I like to output a space before the "accessed/day" output. When I
    enter a character like "x" as prefix this results in the desired
    output, but a " "(space) seems to be supressed. I'm confused because
    the workarround is not good (see exemple code). What can be done?

  • Using Firefox german i work with localized dates; with the short
    month form in german there is a problem: while eight months are really
    shortened to three characters (Jan, Feb, Apr, Aug, Sep, Okt, Nov, Dez)
    the remaining are not shortened (März, Mai, Juni, Juli). This is in my
    eyes inconsistent, because for the first eight you have to add the "."
    while on the others this looks odd. Is the only way to use if and
    construct two month outputs? Can someone make an exemple how to do
    this? (see exemple code).

<!-- output "URL 22. Jun. 2011: http://www.onlinedomain.org/linkxyz " -->
<group prefix="URL "> <!-- space added because prob with space below -->
<choose>
<if type="legal_case" match="none">
<choose>
<if variable="accessed" match="any">
<date variable="accessed">
<date-part name="day" form="numeric" suffix=". " prefix=" "/> <!-- problem with prefix space? -->
<date-part name="month" form="short" suffix=". "/> <!-- probs with März./Mai./Juni./Juli. in german -->
<date-part name="year" form="long"/>
</date>
</if>
</choose>
<text variable="URL" prefix=": "/>
</if>
</choose>
</group>
  • edited August 19, 2011
    You can set the prefix on the cs:date element instead of the first cs:date-part child element. Month abbreviations are already defined with periods (see https://github.com/citation-style-language/locales/blob/8082ade4c8096e44aed7dc03dfe559dcea86110d/locales-de-DE.xml#L284), so you don't need to add them in the style. Finally, the cs:choose element in your example doesn't do anything (you test for the presence of the "accessed" variable, and only render it when it exists, which is an unnecessary test). So you should be able to just use:

    <group prefix="URL">
    <choose>
    <if type="legal_case" match="none">
    <date variable="accessed" prefix=" ">
    <date-part name="day" form="numeric" suffix=". "/>
    <date-part name="month" form="short"/>
    <date-part name="year" form="long"/>
    </date>
    <text variable="URL" prefix=": "/>
    </if>
    </choose>
    </group>
  • edited August 19, 2011
    1. you don't need the "if" in the middle - if there is no variable "accessed" Zotero won't do anything (though you might want to test for URL).

    2. that is a problem of the automatic conversion from 0.8.1. csl to 1.0 csl - I'd bet you're coding your style in 0.8.1 and that creates a bit of a mess.
    An up to date csl 1.0 version of CMoS is on the repository
    or you can update your own style.
    http://citationstyles.org/downloads/upgrade-notes.html#updating-csl-0-8-styles

    3. That's also a problem with using 0.8.1. - in csl 1.0, all abbrevations are saved with the period included - so you'd remove the period from the suffix, remove the "strip-periods="true" that the auto-converter will put there, and then get Jan., Feb., März, Apr., Mai etc.

    edit: to clarify - Rintze is right about what he writes, but this won't work correctly if I'm right and you're editing a 0.8.1 csl
  • edited August 19, 2011
    Right. See also http://www.zotero.org/support/dev/citation_styles#the_csl_081_to_10_upgrade

    I really hope Zotero enables automatic style updating, so users get rid of (most of) the CSL 0.8.1 styles they accumulated during the pre-Zotero 2.1 days (although it might be a good idea to back up the original styles when enabling automatic style updating, so users who made modifications without changing the style ID won't lose their customized styles).
  • edited August 19, 2011
    Thank you for the fast support Rintze & adamsmith! My system: Win7SP1x32, Firefox 6, Zotero 2.1.8, CSL 1.0, chicago-note-bibliography 2011-05-18. So it should all be the last stable versions. I tested a lot in the last hours (with some code errors and strange cslpreview.xul - behaviour - now solved). The "month form=short" problem seems solved. But for the "space omitting" the following code still gives an undesired output (same for Rintze's code - only a space in the first line after URL gives the desired result):
    <group prefix="URL">
    <choose>
    <if type="legal_case" match="none">
    <date variable="accessed">
    <date-part name="day" form="numeric" prefix=" " suffix=". "/>
    <date-part name="month" form="short" suffix=" "/>
    <date-part name="year" form="long"/>
    </date>
    <text variable="URL" prefix=": "/>
    </if>
    </choose>
    </group>

    exemple output: "URL11. März 2011: www.testingurl.net"
    The "space" after URL is missing. See here for a one-month valid link to the full CSL-code file: http://pastebin.com/K3VnSdDL
  • yep, I can confirm that. What's apparently happening is that somethings "swallows" spaces - if you put three spaces in the prefix you actually get one. So for some strange reason two spaces are taken out.
    Moving the prefix to the <date variable.. line doesn't work, either.

    I have double checked and your style validates, so that's not the issue.
    Have you tried installing the style? Maybe this is just a problem in the test panel?
    In any case you're doing everything right and this is a bug.
  • It's a bug in the CSL processor. As a workaround, you can use:

    <text value=" "/>
    <date variable="accessed">
    <date-part name="day" form="numeric" suffix=". "/>
    <date-part name="month" form="short" suffix=" "/>
    <date-part name="year" form="long"/>
    </date>
  • @adamsmith: yes, I have installed the style. Very thank you again to both of you. I'm very happy to move forward. For now I will use Rintze's workaround.
    Now I focus on some more extensions to the style. Looking forward to understand CSL better (f.e. macros and choose-tag).
Sign In or Register to comment.