disappearing author

10 views
Skip to first unread message

Carles Pina

unread,
Nov 10, 2010, 12:50:07 PM11/10/10
to citeproc-js mailing list
Hi,

Sorry for the fuzzy subject, I'm not sure how to describe it in a few words.

The particular use case is not a big deal, but I would like to know
what's going on (looks like a potential bug in citeproc-js or I've
missed something).

Using the attached file without changes citeproc-js returns:
------
<div class="csl-bib-body">
<div class="csl-entry"> @article{ Family01_2008, title={Some title},
year={2008}, month={Jan}}</div>
</div>
------
(I was expecting to have "author={ Family01, Given01}" before the year).

If I delete the line 48:
<text macro="author-short" text-case="lowercase"/>

citeproc-js returns:
-------
<div class="csl-bib-body">
<div class="csl-entry"> @article{2008, title={Some title}, author={
Family01, Given01}, year={2008}, month={Jan}}</div>
</div>
-------

Notice that the "author=" appears and the "citekey" before the year disappears.

[ I don't think that the best approach to generate BibTeX is using
CSL, but can be handy :-) -and useful to train citeproc-js - .Even a
style to generate a nice HTML formatted code, CSV, SQL statements,
etc., could be generated if needed, with many limitations. ]

--
Carles Pina | Software Engineer
http://www.mendeley.com/profiles/Carles-Pina/

Mendeley Limited | London, UK | www.mendeley.com
Registered in England and Wales | Company Number 6419015

bugreports_bibtex.txt
bibtex-x.csl

Frank Bennett

unread,
Nov 10, 2010, 5:11:41 PM11/10/10
to citeproc-js
On Nov 11, 2:50 am, Carles Pina <carles.p...@mendeley.com> wrote:
> Hi,
>
> Sorry for the fuzzy subject, I'm not sure how to describe it in a few words.
>
> The particular use case is not a big deal, but I would like to know
> what's going on (looks like a potential bug in citeproc-js or I've
> missed something).

A name variable rendered through cs:names can only appear once in an
item, by design. A macro might render a name via cs:substitute, and a
subsequent macro might attempt to call the same variable later in the
cite. The suppression behavior provides a compact conditional
mechanism. I think it predates the introduction of cs:choose into CSL
(that was before my time), but it works quite well for normal use
cases.

I think you might be able to get this style to work for you by using
citation-label for the BibTeX key. That's not what it's intended for,
but it should at least get you a valid key for the item. Adding a
proper key generation mechanism would be a CSL issue.



>
> Using the attached file without changes citeproc-js returns:
> ------
> <div class="csl-bib-body">
>   <div class="csl-entry"> @article{ Family01_2008, title={Some title},
> year={2008}, month={Jan}}</div>
> </div>
> ------
> (I was expecting to have "author={ Family01, Given01}" before the year).
>
> If I delete the line 48:
>       <text macro="author-short" text-case="lowercase"/>
>
> citeproc-js returns:
> -------
> <div class="csl-bib-body">
>   <div class="csl-entry"> @article{2008, title={Some title}, author={
> Family01, Given01}, year={2008}, month={Jan}}</div>
> </div>
> -------
>
> Notice that the "author=" appears and the "citekey" before the year disappears.
>
> [ I don't think that the best approach to generate BibTeX is using
> CSL, but can be handy :-) -and useful to train citeproc-js - .Even a
> style to generate a nice HTML formatted code, CSV, SQL statements,
> etc., could be generated if needed, with many limitations. ]
>
> --
> Carles Pina | Software Engineerhttp://www.mendeley.com/profiles/Carles-Pina/
>
> Mendeley Limited | London, UK |www.mendeley.com
> Registered in England and Wales | Company Number 6419015
>
>  bugreports_bibtex.txt
> < 1KViewDownload
>
>  bibtex-x.csl
> 7KViewDownload

Simon Kornblith

unread,
Nov 10, 2010, 5:44:22 PM11/10/10
to citep...@googlegroups.com
On Nov 10, 2010, at 5:11 PM, Frank Bennett wrote:

> On Nov 11, 2:50 am, Carles Pina <carles.p...@mendeley.com> wrote:
>> Hi,
>>
>> Sorry for the fuzzy subject, I'm not sure how to describe it in a few words.
>>
>> The particular use case is not a big deal, but I would like to know
>> what's going on (looks like a potential bug in citeproc-js or I've
>> missed something).
>
> A name variable rendered through cs:names can only appear once in an
> item, by design. A macro might render a name via cs:substitute, and a
> subsequent macro might attempt to call the same variable later in the
> cite. The suppression behavior provides a compact conditional
> mechanism. I think it predates the introduction of cs:choose into CSL
> (that was before my time), but it works quite well for normal use
> cases.


Zotero 2.0.x used to exclude any names or other variables that were rendered during substitution. If a style didn't use cs:substitute or if the substitution wasn't triggered, there was no limit to the number of times a name variable could be rendered. I don't have really have strong feelings about this, since BibTeX export through CSL is a bit of an edge case and for every bibliographic style I can think of, this shouldn't be a problem.

Is a canonical behavior documented in the schema now? I glanced at it and couldn't find anything obvious, but maybe I'm missing something. If not, it's probably ultimately my fault.

Simon

Frank Bennett

unread,
Nov 10, 2010, 8:06:38 PM11/10/10
to citeproc-js
I'll eventually get this right. :) The citeproc-js code behind
cs:substitute is a little convoluted, but I should be able to
replicate the original behavior. Will put it on the todo list.

Frank


>
> Simon

Frank Bennett

unread,
Nov 12, 2010, 8:35:45 PM11/12/10
to citeproc-js
Done and committed.

>
> Frank
>
>
>
> > Simon

Carles Pina

unread,
Nov 12, 2010, 8:38:51 PM11/12/10
to citep...@googlegroups.com
Hi,

On 13 November 2010 01:35, Frank Bennett <bierc...@gmail.com> wrote:

>> I'll eventually get this right.  :)  The citeproc-js code behind
>> cs:substitute is a little convoluted, but I should be able to
>> replicate the original behavior.  Will put it on the todo list.
>
> Done and committed.

Yes, in 1.0.71 right? I tested it and everything all right. Thanks

--
Carles Pina | Software Engineer

Frank Bennett

unread,
Nov 12, 2010, 8:41:32 PM11/12/10
to citeproc-js
On Nov 11, 7:44 am, Simon Kornblith <si...@simonster.com> wrote:
The specficiation has this:

"Substituted variables are repressed in the rest of the output to
prevent duplication."

So the specification does require the original behavior, and citeproc-
js was being over-aggressive.

Frank Bennett

unread,
Nov 12, 2010, 8:43:45 PM11/12/10
to citeproc-js
On Nov 13, 10:38 am, Carles Pina <carles.p...@mendeley.com> wrote:
> Hi,
>
> On 13 November 2010 01:35, Frank Bennett <biercena...@gmail.com> wrote:
>
> >> I'll eventually get this right.  :)  The citeproc-js code behind
> >> cs:substitute is a little convoluted, but I should be able to
> >> replicate the original behavior.  Will put it on the todo list.
>
> > Done and committed.
>
> Yes, in 1.0.71 right? I tested it and everything all right. Thanks

Yep. Insufficient coffee this morning, I was thinking it was in the
upcoming 1.0.72 release.

>
> --
> Carles Pina | Software Engineerhttp://www.mendeley.com/profiles/Carles-Pina/
Reply all
Reply to author
Forward
0 new messages