Punctuation issues

I’m very close to completing an updated version of my JavaScript-based
parser. However, if I strictly follow the schema, I get output like this:

Rosenzweig, R… (1983). Eight hours for what we will : workers and leisure
in an industrial city, 1870-1920.New York:Cambridge University Press.

If I add an editor, I get:

Doe, J… (1996). My Book., Hitchcock, A. editor.New York:Random House.

Shall I simply say, if there are two periods or commas anywhere in the
bibliographic output, get rid of the first one (or, for the regular
expression inclined, s/.,/$1/g)? Or do we need more complex rules to
solve this?

Simon

The fist question is, why are you getting the spurious output? Is there
something wrong with the style and/or the schema? Generally speaking,
the design is such that this would more-than-likely be a bug of some
sort.

I did recall a case where it’s hard to avoid problems, though, but I
can’t remember what it was.

Bruce

The style is defined as:

  <item suffix=".">
    <choose>
      <type name="book">
        <author/>
        <date prefix=" (" suffix=").">
          <year/>
        </date>
        <titles font-style="italic" prefix=" " suffix="."/>
        <editor prefix=", "/>
        <publisher/>
        <access prefix=" "/>
      </type>

If you have a contributor with initialize-with=".", and the contributor
field has suffix=".", you will inevitably sometimes end up with an extra
period. You can’t get rid of the suffix, because then institutional authors
and authors with no last name will lack a period. We definitely need some
rules to handle this.

As for the case of the editor, I actually can’t find any resources that list
what I’m supposed to do with a book which has both an author and an editor
(do such books exist?), so this may be a moot point in this situation, but
the same thing will happen with pages. I think it’s fixable within the
style; I’ll give it a try.

Simon

We definitely need some rules to handle this.

OK, let’s do it then, but try to catch where there are bugs.

As for the case of the editor, I actually can’t find any resources
that list
what I’m supposed to do with a book which has both an author and an
editor
(do such books exist?),

Yes, there are books that have authors, editors and translators; I have
one on my shelf:

<http://www.amazon.com/gp/product/0674013557/sr=8-5/qid=1155415329/
ref=pd_bbs_5/104-7919287-9567914?ie=UTF8>

so this may be a moot point in this situation, but
the same thing will happen with pages. I think it’s fixable within the
style; I’ll give it a try.

OK, let me know. I’ll probably deal with the schema changes tomorrow.

Do you need SVN access Simon?

Bruce

OK, let me know. I’ll probably deal with the schema changes tomorrow.

Okay, I think I’ve got everything working properly. I’m still not positive
the output is 100% correct, but it matches the output guidelines on the
Internet for the items I was working with. To perfect things, I might have
to find a copy of the APA Style Guide (apparently the APA’s single most
profitable enterprise), but in any case, this output is much closer to
right, and didn’t require any schema modifications.

The downside is that there’s a bit of repetition:

<contributor>
  <name and="symbol" sort-separator=", " initialize-with="."/>
  <role prefix=", " />
</contributor>
<author>
  <substitute>
    <choose>
      <editor>
        <name and="symbol" sort-separator=", " initialize-with="."/>
        <role prefix=" (" suffix=")" />
      </editor>
      <translator>
        <name and="symbol" sort-separator=", " initialize-with="."/>
        <role prefix=" (" suffix=")" />
      </translator>
      <titles relation="container" font-style="italic"/>
      <titles>
        <name form="short"/>
      </titles>
    </choose>
   </substitute>
</author>

This is because, where there is no author but there is an editor, we need
output like:

Duncan, G.J., & Brooks-Gunn, J. (Eds.). (1997). Consequences of growing up
poor. New York: Russell Sage Foundation.

But where there are both authors and editors, we need output like:

Plath, S. (2000). The unabridged journals (K.V. Kukil, Ed.). New York:
Anchor.

Is it worth trying to alter the schema to avoid this repetition? I’m exactly
not sure what one could do.

Do you need SVN access Simon?

It might make things easier. I could also email you the file, if you’d
prefer to review it first. Whatever’s more convenient for you.

Simon

If I’m reading this right, the CSL fragment doesn’t match the expected
output.

One obvious change to consider is to have role is as top-level default?

Just send me your SF account name.

Bruce

If I’m reading this right, the CSL fragment doesn’t match the expected
output.

I just realized that you are, in fact, correct. The output I get with both
an author and an editor is:

Rosenzweig, R. (1986). Government and the arts in thirties America : a guide
to oral histories and other research materials (Jones, B., editor). Lanham,
MD: Distributed by arrangement with University Pub. Associates.

Where (B. Jones, editor) should be (Jones, B., editor).

Is getting rid of the sort-separator attribute supposed to nullify the
author-as-sort-order attribute on ? If so, I can fix this
without schema modifications. Otherwise, perhaps author-as-sort-order should
be an attribute of or ?

The output for an editor but no author does in fact match:

Rosenzweig, R. (editor). (1994). The park and the people : a history of
Central Park. New York: H. Holt and Co.

(Although actually, editor should be Ed., but that’s pending schema
modification.)

One obvious change to consider is to have role is as top-level default?

I don’t think this solves the problem. (Can you come up syntax where it
works? Perhaps I’m just misunderstanding you.) We could do something like:

<contributor>
  <name and="symbol" sort-separator=", " initialize-with="."/>
  <role prefix=", " />
</contributor>
<author>
  <substitute>
    <choose>
      <contributor role="editor,translator">
        <name and="symbol" initialize-with="."/>
        <role prefix=" (" suffix=")" />
      </contributor>
      <titles relation="container" font-style="italic"/>
      <titles>
        <name form="short"/>
      </titles>
    </choose>
   </substitute>
</author>

It seems inevitable that both and need to be redefined, but by
letting the role attribute take multiple roles, we can redefine it only
once. (But then again, how many books have a translator but no author,
besides the Bible? Maybe I could just get rid of the tag in
?)

Simon

I guess if we take this example …

Duncan, G.J., & Brooks-Gunn, J. (Eds.). (1997). Consequences of
growing up
poor. New York: Russell Sage Foundation.

But where there are both authors and editors, we need output like:

Plath, S. (2000). The unabridged journals (K.V. Kukil, Ed.). New York:
Anchor.

I’d say:

… etc.

How’s that?

Bruce

The problem I see (perhaps there’s another?) is how to solve the prefix and
suffix issues on the roles. In the first case, the role needs " (" before
and “)” after, while in the second case, the role needs ", " before and
nothing after (the parentheses are on the whole field).

Additionally, there’s the problem of controlling name inversion (Doe, J. if
the editor replaces the author, or J. Doe if not), which I spoke about in
the previous email.

Simon

Rosenzweig, R. (1986). Government and the arts in thirties America : a
guide
to oral histories and other research materials (Jones, B., editor).
Lanham,
MD: Distributed by arrangement with University Pub. Associates.

Where (B. Jones, editor) should be (Jones, B., editor).

I think I see. When you do substitution, you are wanting to carry the
formatting logic along with the variable.

That’s not how I see it. If an editor is substituted for an author,
then the editor takes on the formatting of the author. So …

Is getting rid of the sort-separator attribute supposed to nullify the
author-as-sort-order attribute on ?

No. Sort separator apples simply if a name gets displayed as the sort
order. And the order may vary between citations and bib.

If so, I can fix this
without schema modifications. Otherwise, perhaps author-as-sort-order
should
be an attribute of or ?

The essential thing about the author-as-ssrt-order attribute is it
defines the ordering of each name within a list of names, regardless of
the variable (if author, editor, etc.).

The output for an editor but no author does in fact match:

Rosenzweig, R. (editor). (1994). The park and the people : a history of
Central Park. New York: H. Holt and Co.

(Although actually, editor should be Ed., but that’s pending schema
modification.)

text-transform=“capitalize”

… though I’m still thinking that ought to be default.

One obvious change to consider is to have role is as top-level
default?

I don’t think this solves the problem.

You’re probably right. Was just thinking might avoid some potential
duplication.

See if my explanation at top solves your problem (as I am seeing it,
there isn’t one).

[…]

It seems inevitable that both and need to be redefined,
but by
letting the role attribute take multiple roles, we can redefine it only
once. (But then again, how many books have a translator but no author,
besides the Bible? Maybe I could just get rid of the tag
in
?)

Am not sure on that one.

There’s actually another problem with the current substitution logic:

A little down the list I have a container title. But actually, that’s
not really specific enough. The rule is typically “periodical-title” |
“title” | “anonymous”

In other words, certain kinds of container titles (may) get
substituted, but not other kinds.

BTW, you now should have developer access (to SVN and such).

Bruce

Rosenzweig, R. (1986). Government and the arts in thirties America : a
guide
to oral histories and other research materials (Jones, B., editor).
Lanham,
MD: Distributed by arrangement with University Pub. Associates.

Where (B. Jones, editor) should be (Jones, B., editor).

I think I see. When you do substitution, you are wanting to carry the
formatting logic along with the variable.

That’s not how I see it. If an editor is substituted for an author,
then the editor takes on the formatting of the author. So …

Ah. Then we have other problems. My previous assumption was that if there
was a substitute element, the substitute element inherited as follows:

child element
overrides
element with the same name in the same
overrides
default element.

I admit that this hierarchy is a bit clearer:

child element
overrides
author element
overrides
default element

But, we need some way to control the italicization of the title, which
depends on the type. In most styles, a book title gets italicized, but an
article title does not. How do we do this within a element? Do
we just assume no one will have books without authors or editors?

We could use the rule that substitute contributors use the second hierarchy
above, while other fields use the first, but that’s kind of a messy
solution.

Is getting rid of the sort-separator attribute supposed to nullify the
author-as-sort-order attribute on ?

No. Sort separator apples simply if a name gets displayed as the sort
order. And the order may vary between citations and bib.

If so, I can fix this
without schema modifications. Otherwise, perhaps author-as-sort-order
should
be an attribute of or ?

The essential thing about the author-as-ssrt-order attribute is it
defines the ordering of each name within a list of names, regardless of
the variable (if author, editor, etc.).

The problem is, in APA, the name order changes depending on the variable.
So, while the element (and and , if they’re
substituted for ) should be author-as-sort-order=“all”, the
tag should be author-as-sort-order=“no”.

The easy way to fix this problem is to add move the author-as-sort-order
attribute to the element (from which and
inherit). Then, you could define author-as-sort-order=“all” in the defaults
and use:

(Ignore the group tag; it’s necessary to put the period in the right place.)

Right, because in those positions, they are never the sort key, so
cannot be displayed as sorted.

Are you making this more complicated than it needs to be?

I recognize there may be styles that do really strange things here, in
which case we should indeed do something like you’re suggesting, but
I’ve not run across one.

Will get back to you on the other questions later …

Bruce

In CBE (which is definitely in the top 10 citation styles we should
support), you get citations like this:

Heisenberg W. The physical principles of the quantum theory. Eckart C, Hoyt
FC, translators. Chicago: U Chicago P; 1930. 278 p.

Eckart C and Hoyt FC aren’t sort keys, but they’re still printed like they
are.

Simon

OK, then. Good you had that example in your pocket!

So yeah, then (not looking right this second at your suggestion) we
need to get rid of the bibliography attribute for this, and instead use
something like for this example:

When using the short form, of course this doesn’t apply.

An alternative is to have a “names_as_sorted” attribute on contributor,
etc., which might make overriding that easier (because you wouldn’t
need a child element to do it). I think this was your suggestion.

Bruce

Yeah, the Amazon link I posted yesterday. But I’m not sure what’s
you’re asking herr.

Bruce

I think the latter is a better idea, for the reason you’ve given. And to
nitpick, shouldn’t it be “names-as-sorted”, with hyphens instead of
underscores, to fit with the conventions of the rest of the schema?

Simon

Yeah, I was just internalizing Johan’s point: that it’s nice to able to
map attribute and elements directly to method calls.

But if people think that’s a good idea, then it does mean being
consistent.

I have no strong opinion on this; might be more trouble than it’s worth
to change.

Bruce

If you have author, editor, and translator, your output (presumably)
becomes:

Plath, S. (2000). The unabridged journals (K.V. Kukil, Ed., J. Doe, Trans.).
New York: Anchor.

Not:

Plath, S. (2000). The unabridged journals (K.V. Kukil, Ed.) (J. Doe,
Trans.). New York: Anchor.

Correct? But how do we model this (admittedly unlikely) situation in CSL?

Simon

They’re different fields, so:

… or:

Don’t ask me how we’d handle some other role; am not sure. Maybe
default mappings?

composer = author
director = author

…?

Bruce