# Custom year-suffix-delimiters

**URL:** <https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583>\
**Category:** CSL Development\
**Created:** [March 26, 2009, 7:38pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583 "2009-03-26T19:38:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [March 26, 2009, 7:38pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/1 "2009-03-26T19:38:16Z")

</div>

There is some variation in the delimiters used for collapsed year-suffixes,  
e.g. “(Doe 2000a, b, c; 2001)” or “(Doe 2000a;b;c, 2001)”. Currently Zotero  
uses a hard coded ", " string as CSL previously did not offer a solution to  
specify this delimiter. Recently Bruce added a new variable, year-suffix, to  
fix this issue (  
[http://sourceforge.net/tracker/?func=detail&aid=2212677&group\_id=117435&atid=678021](http://sourceforge.net/tracker/?func=detail&aid=2212677&group_id=117435&atid=678021)).  
As delimiters can be set for text elements, I guess that the CSL code could  
then look like:

// dates/test001.txt  
{  
“citation”:[{“source”:“productiveJohn”}],  
“testof”: “citation”,  
“csl”:"

 ", "result":"(Doe 2000a,b; 2001)" }

I asked Bruce if this was what he had in mind, and he suggested to me to  
post this example here for discussion. I tried to write it in test format,  
so hopefully it is of some use for Frank.

Rintze

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [March 27, 2009, 6:11am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/2 "2009-03-27T06:11:15Z")

</div>

Rintze,

That looks good to me. I’ll work up some sample data to drive it when  
i get to that point.

Disambiguation by adding names just passed, and I’m feeling a little  
pleased with myself, so I’m going to take a rest from the code for a  
few days. But this was a huge and dreadful step cleared: we’re just  
about ready to play “Break My Program”.

Frank2009/3/27 Rintze Zelle \<@Rintze\_Zelle\>:

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [March 27, 2009, 2:43pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/3 "2009-03-27T14:43:11Z")

</div>

That’s great!

Bruce

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 2, 2009, 7:45am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/4 "2009-04-02T07:45:58Z")

</div>

Rintze,

I’ve taken a closer look at the year-suffix test, and I’d like to  
raise just one issue re the year-suffix variable. Here’s the test:

[http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/tests/dates/test001.txt?revision=857&view=markup](http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/tests/dates/test001.txt?revision=857&view=markup)

Here’s the discussion of the year-suffix variable that the test illustrates:

[https://sourceforge.net/mailarchive/forum.php?thread\_name=53208a5f0903020639n7da5d177p47e6f243f7f90e9b%40mail.gmail.com&forum\_name=xbiblio-devel](https://sourceforge.net/mailarchive/forum.php?thread_name=53208a5f0903020639n7da5d177p47e6f243f7f90e9b%40mail.gmail.com&forum_name=xbiblio-devel)

I’m onboard with treating year-suffix as a magic variable rendered  
through a text element. I didn’t do things that way in the first-cut  
implementation of year-suffix that I just finished, but that was an  
oversight; this is the right way to do it.

I get stuck on that delimiter=",", though. I wonder whether its  
function might be a little too far removed from that of ordinary  
delimiters to have the the same attribute name. Text elements can  
take a delimiter= attribute already, but it’s a delimiter between  
components contained inside the element (i.e. for a text element,  
between multiple variables). The same is true of all other delimiters  
in CSL; multiple elements within the element holding the delimiter=  
attribute are joined with it. In this case, though, it sets a magic  
prefix, used when joining the year-suffix to a preceding cite, when  
the suffix is the first thing rendered. I don’t think that’s obvious  
from the term and its appearance in the code. Could it possibly be  
given a special name, maybe something with “collapse” in it, to  
provide a hint?

Frank

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 2, 2009, 9:41am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/5 "2009-04-02T09:41:41Z")

</div>

When I wrote the test, I was also struck by how differently “delimiter” is  
used in this specific case. The only thing that comes close to the thing we  
want to achieve here is the current way to set delimiters between different  
cited items in a citation cluster (if I have the terminology right): via the  
layout-element. Maybe here support for an additional argument could be  
included, e.g.:

This would keep things together and might be clearer.

Rintze

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [April 2, 2009, 12:27pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/6 "2009-04-02T12:27:16Z")

</div>

Or it could be an option (“year-suffix-delimiter”). I’d probably opt for that.

Bruce2009/4/2 Rintze Zelle \<@Rintze\_Zelle\>:

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 2, 2009, 12:42pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/7 "2009-04-02T12:42:35Z")

</div>

> > When I wrote the test, I was also struck by how differently “delimiter” is  
> > used in this specific case. The only thing that comes close to the thing we  
> > want to achieve here is the current way to set delimiters between different  
> > cited items in a citation cluster (if I have the terminology right): via the  
> > layout-element. Maybe here support for an additional argument could be  
> > included, e.g.:
> > 
> > This would keep things together and might be clearer.
> 
> Or it could be an option (“year-suffix-delimiter”). I’d probably opt for that.

I’d be happy with that if there is agreement all around.

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 2, 2009, 1:53pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/8 "2009-04-02T13:53:26Z")

</div>

That’s fine (you proposed this earlier:  
[http://sourceforge.net/mailarchive/message.php?msg\_name=fbb7c5df0903031708r54e6db1bq9e76a0d797d6d1ed%40mail.gmail.com](http://sourceforge.net/mailarchive/message.php?msg_name=fbb7c5df0903031708r54e6db1bq9e76a0d797d6d1ed%40mail.gmail.com)  
).

Rintze

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 4, 2009, 11:03am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/9 "2009-04-04T11:03:53Z")

</div>

> That’s fine (you proposed this earlier:  
> [http://sourceforge.net/mailarchive/message.php?msg\_name=fbb7c5df0903031708r54e6db1bq9e76a0d797d6d1ed%40mail.gmail.com](http://sourceforge.net/mailarchive/message.php?msg_name=fbb7c5df0903031708r54e6db1bq9e76a0d797d6d1ed%40mail.gmail.com)).

This is now working in the fbennett branch of citeproc-js.

As if to drive home the value of varied contributions to the test  
suite, implementing this feature turned up two important bugs in  
citeproc-js that I hadn’t come across on my own: reverse ordering of  
times registered without a sort key; and superfluous spacing in some  
grouped environments. So special thanks to Rintze for this; it’s the  
first contributed test, and it caught three birds with one stone!

Test:  
[XBib download | SourceForge.net](http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/tests/dates/test001.txt?revision=863&view=markup)

Data:  
[XBib download | SourceForge.net](http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/items/year-suffixes-1.txt?revision=833&view=markup)  
[XBib download | SourceForge.net](http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/items/year-suffixes-2.txt?revision=833&view=markup)  
[XBib download | SourceForge.net](http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/citeproc-js/branches/fbennett/std/items/year-suffixes-3.txt?revision=833&view=markup)

Frank2009/4/2 Rintze Zelle \<@Rintze\_Zelle\>:

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 4, 2009, 12:59pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/10 "2009-04-04T12:59:38Z")

</div>

As for the changes this requires in the schema, is this what you had in  
mind, Bruce?

[http://groups.google.com/group/zotero-dev/web/year-suffix-delimiter.patch](http://groups.google.com/group/zotero-dev/web/year-suffix-delimiter.patch)

Rintze

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [April 4, 2009, 2:03pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/11 "2009-04-04T14:03:05Z")

</div>

Yes, but we might want to specify a generic delimited pattern, rather  
than to use ‘text’. Do we want to constrain that with a regular  
expeessio, or not?

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 4, 2009, 2:07pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/12 "2009-04-04T14:07:50Z")

</div>

What could be the benefit of limiting the possible values?

Rintze

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [April 4, 2009, 2:20pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/13 "2009-04-04T14:20:50Z")

</div>

Mainly clarity. There’s no practical point in allowing someone to have  
a value of “aaaa” or “24”; likely the only values can be represented  
something like “\s\*(:|;|,)?\s\*”.

But admittedly it’s not that important; just asking.

Bruce

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 4, 2009, 4:58pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/14 "2009-04-04T16:58:17Z")

</div>

Well, okay. I don’t have a strong opinion though (I don’t know if the  
increased clarity in the use of the schema outweighs the added complexity of  
the schema and the decreased flexibility in the creation of styles).

BTW, this is a bit off-topic, but while I was browsing Google Scholar  
looking for different types of delimiters, I came across something else:  
collapsing of year-suffixes, e.g.:

“(O’Reilly et al., 1997; Dhanabal et al., 1999a–c)” and “[Korzan et al.,  
2000a-c]“  
versus  
”(Hall, 2000; Domingo, 1999; Barron, 2000abc)”

So, do we want to support this (I think we should), and if so, how? Maybe a  
boolean option (e.g. collapse-year-suffixes) would suffice?

Rintze

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 4, 2009, 11:12pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/15 "2009-04-04T23:12:55Z")

</div>

> Well, okay. I don’t have a strong opinion though (I don’t know if the  
> increased clarity in the use of the schema outweighs the added complexity of  
> the schema and the decreased flexibility in the creation of styles).
> 
> BTW, this is a bit off-topic, but while I was browsing Google Scholar  
> looking for different types of delimiters, I came across something else:  
> collapsing of year-suffixes, e.g.:
> 
> “(O’Reilly et al., 1997; Dhanabal et al., 1999a–c)” and “[Korzan et al.,  
> 2000a-c]”  
> versus  
> “(Hall, 2000; Domingo, 1999; Barron, 2000abc)”
> 
> So, do we want to support this (I think we should), and if so, how? Maybe a  
> boolean option (e.g. collapse-year-suffixes) would suffice?

At the implementation level, this is collapse=“citation-number” with  
different colors; it shouldn’t much extra trouble to support it. But  
it raises an off-by-one issue in the naming scheme for the collapse  
options. While it would change existing CSL, but would it be possible  
to adopt the following progression:

(equals current "year") (equals current "year-suffix") (this new feature)

Frank

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [April 5, 2009, 4:19pm UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/16 "2009-04-05T16:19:42Z")

</div>

Good point.

OTOH, if we contemplated this, we might as well through in another  
related issue and address them all together:

Page number collapsing sometimes follows different algorithms. In my  
implementation, I just used Chicago’s. But one could imagine there may  
be others.

So the issue may be not just whether to collapse a particular list of  
tokens or integers, but how.

Bruce

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 6, 2009, 9:05am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/17 "2009-04-06T09:05:38Z")

</div>

> > > Well, okay. I don’t have a strong opinion though (I don’t know if the  
> > > increased clarity in the use of the schema outweighs the added complexity of  
> > > the schema and the decreased flexibility in the creation of styles).
> > > 
> > > BTW, this is a bit off-topic, but while I was browsing Google Scholar  
> > > looking for different types of delimiters, I came across something else:  
> > > collapsing of year-suffixes, e.g.:
> > > 
> > > “(O’Reilly et al., 1997; Dhanabal et al., 1999a–c)” and “[Korzan et al.,  
> > > 2000a-c]”  
> > > versus  
> > > “(Hall, 2000; Domingo, 1999; Barron, 2000abc)”
> > > 
> > > So, do we want to support this (I think we should), and if so, how? Maybe a  
> > > boolean option (e.g. collapse-year-suffixes) would suffice?
> > 
> > At the implementation level, this is collapse=“citation-number” with  
> > different colors; it shouldn’t much extra trouble to support it. But  
> > it raises an off-by-one issue in the naming scheme for the collapse  
> > options. While it would change existing CSL, but would it be possible  
> > to adopt the following progression:
> > 
> > (equals current "year") (equals current "year-suffix") (this new feature)
> 
> Good point.
> 
> OTOH, if we contemplated this, we might as well through in another  
> related issue and address them all together:
> 
> Page number collapsing sometimes follows different algorithms. In my  
> implementation, I just used Chicago’s. But one could imagine there may  
> be others.
> 
> So the issue may be not just whether to collapse a particular list of  
> tokens or integers, but how.

I spent some time thinking about this one today, and saw this recent  
item on the Zotero forum:

> **[Automatically choose whether hyphen, en dash, or em dash should be used](https://forums.zotero.org/discussion/5915/automatically-choose-whether-hyphen-en-dash-or-em-dash-should-be-used/#Item_0)**
>
> Since different citation styles deal differently with en and em dashes, I think that Zotero should at some point be handling the correct use of dashes.

Localizing the range join character would be simple enough. I’m  
wondering about what might happen with final joins in a numeric  
series.

How much variety is there likely to be? If one were to aim at  
supporting hard cases, so that easy cases take care of themselves, I  
think the following may cover the possible extent of the pain:

The two series [1,2,3,5,6,7] and [1,2,3,5,7] could render as:

1,2,3,5,6,7 and 1,2,3,5,7 (series)

1-3,5-7 and 1-3,5,7 (series with range collapse only)  
1,2,3,5,6&7 and 1,2,3,5&7 (series with final join only)

1-3&5-7 and 1-3,5&7 (both, priority for range joins, final join for  
ranges ok)  
1-3,5-7 and 1-3,5&7 (both, priority for range joins, final join for  
singletons only)  
1-3,5,6&7 and 1-3,5&7 (both, priority for singleton joins)

(Plus things should work with arabic, roman or year-suffix, but that’s  
just an implementation wrinkle.) Some of these don’t make any sense,  
but on the assumption that editorial caprice knows no bounds, I wonder  
what the CSL options capable of capturing all of them would look like.

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 7, 2009, 7:46am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/18 "2009-04-07T07:46:46Z")

</div>

Just to add some complexity, maybe this should be handled in CSL as well:  
[https://www.zotero.org/trac/ticket/1083](https://www.zotero.org/trac/ticket/1083)

“For better or worse IEEE wants brackets to work in a different way than the  
CSL suggests.  
Multiple citations must appear like [1]-[5], not like [1-5].”

RintzeOn Mon, Apr 6, 2009 at 11:05 AM, Frank Bennett \<@Frank\_Bennett\>wrote:

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [April 7, 2009, 8:04am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/19 "2009-04-07T08:04:55Z")

</div>

More complexity:  
[http://groups.google.com/group/zotero-dev/browse\_thread/thread/674585c991cc8e11](http://groups.google.com/group/zotero-dev/browse_thread/thread/674585c991cc8e11)

“I’m trying to create a new style which uses only the start page [ed:from a  
page range].”

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [April 7, 2009, 11:01am UTC](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583/20 "2009-04-07T11:01:31Z")

</div>

> More complexity:  
> [http://groups.google.com/group/zotero-dev/browse\_thread/thread/674585c991cc8e11](http://groups.google.com/group/zotero-dev/browse_thread/thread/674585c991cc8e11)
> 
> “I’m trying to create a new style which uses only the start page [ed:from a  
> page range].”

Glad to see this, actually, it’s required by Bluebook. You could  
maybe just do something like:

?

> > Just to add some complexity, maybe this should be handled in CSL as well:  
> > [#1083 (Defect in IEEE CSL with Multiple Citations) – Zotero](https://www.zotero.org/trac/ticket/1083)
> > 
> > “For better or worse IEEE wants brackets to work in a different way than  
> > the CSL suggests.  
> > Multiple citations must appear like [1]-[5], not like [1-5].”

Looks like maybe a case for multiple collapse values …

?

Frank

[Next page](https://discourse.citationstyles.org/t/custom-year-suffix-delimiters/583.md?page=2)
