# Multiple-item "type" conditionals with match="all"

**URL:** <https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155>\
**Category:** CSL Development\
**Created:** [February 26, 2013, 4:21pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155 "2013-02-26T16:21:16Z")\
**Posts on this page:** 15\
**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:** [February 26, 2013, 4:21pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/1 "2013-02-26T16:21:16Z")

</div>

Andrea Rossato recently identified a discrepancy between the CSL spec  
and citeproc-js. While the spec describes match=“all” to be the  
default for conditionals, citeproc-js uses “any”. See  
[http://citationstyles.org/downloads/specification.html#choose](http://citationstyles.org/downloads/specification.html#choose) and  
[http://forums.zotero.org/discussion/27961/chicago-styles-no-year-in-bibliography/](http://forums.zotero.org/discussion/27961/chicago-styles-no-year-in-bibliography/)  
for more details.

Since most CSL styles have been developed against citeproc-js  
implementations, this has gone unnoticed for quite some time.

I would prefer to keep “all” as the default, if possible. For the  
short term, I fixed styles that used the “type” conditional to test  
for multiple item types without setting “match”. According to the  
spec, such conditionals should never test true, and so I’ve added  
match=“any” to these cases:

> <https://github.com/citation-style-language/styles/commit/b55a9c1704b74a35e9aa522dc4e67dc632146781>

We can probably expect some changes in citeproc-js output if it  
changes its behavior. I’ll think about it a bit more to see if we can  
modify the existing styles to prevent that from happening.

Rintze

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [February 26, 2013, 4:47pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/2 "2013-02-26T16:47:33Z")

</div>

CiteProc-Ruby uses ‘all’ as the default – in this respect, perhaps the spec should explicitly define what the edge cases are, particularly what happens when there are no conditions. This seems fairly important to me. For example, in the Ruby implementation we’re assuming that:

all + no conditions --\> true  
any + no conditions --\> false

This is particularly important, because we handle ‘else’ like a regular ‘if’ node with no conditions (in fact, both if and else nodes are mapped to a conditional node internally, so the processor does not need to distinguish between the too).

Note that the assumptions above are based on predicate logic (universal quantification over the empty set is always true). Furthermore, the fact, that this yields the ‘logical’ implementation of the else node above is a strong indication that it does indeed make sense to keep ‘all’ as the default.

---

<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:** [February 26, 2013, 4:56pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/3 "2013-02-26T16:56:17Z")

</div>

cs:if and cs:else-if elements require at least one condition. The CSL  
schema checks for this.

Rintze

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [February 26, 2013, 5:11pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/4 "2013-02-26T17:11:12Z")

</div>

True : ) that takes care of the edge cases as far as the specification is concerned.

Nevertheless, it wouldn’t hurt if implementations agreed to apply predicate logic there.

---

<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:** [February 26, 2013, 10:09pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/5 "2013-02-26T22:09:36Z")

</div>

Dear all,

I’m very sorry for this misstep. The default to “any” was coded into  
citeproc-js before the specification existed, without sufficient  
thought.

---

<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 5, 2013, 4:18am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/6 "2013-03-05T04:18:26Z")

</div>

I set “match” to “any” in what should the remaining problematic cases:

> <https://github.com/citation-style-language/styles/commit/532217b02629a7dc4f91113f7dddbf458e1c9e80>

Related Python script update (don’t look if you’re a  
professional/experienced programmer!):

> <https://github.com/citation-style-language/utilities/commit/3d8a46f0ef2fdb77e2be818097a868770964bb94>

Frank, I think now is as good a time as any to change the “match”  
default in citeproc-js to “all”.

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 5, 2013, 4:31am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/7 "2013-03-05T04:31:52Z")

</div>

Sebastian: You might see a rise in complaints about things going  
missing from citations when a change in the default works its way into  
official Zotero. Okay to go ahead?

Frank

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [March 5, 2013, 4:42am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/8 "2013-03-05T04:42:04Z")

</div>

sure. But what’s the current status of Zotero auto-updating styles? I  
thought that was happening now - Dan?  
If that’s the case we should be mostly good anyway.  
S.

---

<div class="post-metadata">

**Author:** ![Dan\_Stillman](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@Dan\_Stillman](https://discourse.citationstyles.org/u/Dan_Stillman)\
**Post date:** [March 5, 2013, 8:03am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/9 "2013-03-05T08:03:47Z")

</div>

Currently only the bundled styles are updated, and only when Zotero is  
upgraded. Auto-updating of all installed styles is in 3.1, which should  
be out by the end of the month.

---

<div class="post-metadata">

**Author:** ![Robert\_Knight](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@Robert\_Knight](https://discourse.citationstyles.org/u/Robert_Knight)\
**Post date:** [March 5, 2013, 10:07am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/10 "2013-03-05T10:07:36Z")

</div>



---

<div class="post-metadata">

**Author:** ![Simon\_Hewitt](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Simon\_Hewitt](https://discourse.citationstyles.org/u/Simon_Hewitt)\
**Post date:** [March 6, 2013, 9:03am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/11 "2013-03-06T09:03:34Z")

</div>

Does CSL allow for inputs to contain any formatting markup?

For example, given this BibTex title:

title = {Distribution of \textit{Culicoides} Latreille (Diptera:  
Ceratopogonidae) in Saudi Arabia}

Docear4Word contains a BibTex parser that will strip out all the braces and  
formatting directives before it gets passed to CiteProc.js but the user  
would like to have the word ‘Culicoides’ in italic regardless of the CSL  
style being used.

I can change the parser to replace \textit{…} with any markup but I don’t  
believe CSL supports this.  
I am guessing that even if I use HTML markup and ask for HTML output then it  
is likely to be escaped before it comes back (haven’t actually tried this)

Can someone confirm this isn’t possible?

Cheers  
Simon

---

<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 6, 2013, 11:42am UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/12 "2013-03-06T11:42:14Z")

</div>

The processor recognizes the markup described here:

[http://www.zotero.org/support/kb/rich\_text\_bibliography](http://www.zotero.org/support/kb/rich_text_bibliography)

It looks like HTML, but it’s converted in the output.

---

<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 6, 2013, 1:58pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/13 "2013-03-06T13:58:55Z")

</div>

See also [http://citationstyles.org/downloads/upgrade-notes.html#rich-text-markup-within-fields](http://citationstyles.org/downloads/upgrade-notes.html#rich-text-markup-within-fields)

The tag has since been deprecated in favor of the more standard  
, but citeproc-js supports  
both.

Rintze

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [March 6, 2013, 4:30pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/14 "2013-03-06T16:30:09Z")

</div>

Zotero does convert BibTeX markup for the supported HTML and Mendeley was  
at least talking about implementing that, too - not sure if they did.

---

<div class="post-metadata">

**Author:** ![Robert\_Knight](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@Robert\_Knight](https://discourse.citationstyles.org/u/Robert_Knight)\
**Post date:** [March 6, 2013, 5:59pm UTC](https://discourse.citationstyles.org/t/multiple-item-type-conditionals-with-match-all/1155/15 "2013-03-06T17:59:40Z")

</div>

> Zotero does convert BibTeX markup for the supported HTML and Mendeley was at least talking about implementing that, too - not sure if they did.

Our current plan is to formalize the XHTML subset that is supported  
inside various metadata fields which will initially be quite minimal.  
We have discussed converting TeX markup during BibTeX import but have  
not implemented this yet.

Regards,  
Rob.
