inukshuk / citeproc-ruby

A Citation Style Language (CSL) Cite Processor
101 stars 22 forks source link

Fix for issue #42 #43

Closed lightman76 closed 7 years ago

lightman76 commented 7 years ago

I've introduced a new format called sort which extends text and overrides it to prevent the generation of the quotes during rendering. I've changed the sort! method to use this format (previously it forced text format).

I've added the mla8 csl as part of the test suite so I could demonstrate the bug and then fix it.

Also, there's a commit that fixes two typos in sort.rb I noticed while digging into this problem.

Please let me know if I missed a better way to do accomplish this.

inukshuk commented 7 years ago

That's an interesting find!

I'm curious though, if this is is really something we should handle via an extra format or if this isn't actually a problem with the style.

@rmzelle can you help out? The question is whether or not a macro should be rendered with a different format (e.g., one which suppresses quotes) when used for sorting.

rmzelle commented 7 years ago

The question is whether or not a macro should be rendered with a different format (e.g., one which suppresses quotes) when used for sorting.

I think quotes are typically ignored for sorting. @adam3smith, do you know if any of the major style guides have an opinion on this? (also cc-ing @fbennett)

inukshuk commented 7 years ago

Actually, switching to text format for sorting was already a form of special treatment for rendering nodes when used for sorting. I'd still be interested to know if suppressing quotes is something the processor should do automatically or if it is something regulated by a style guide (in the latter case, I think this is something that should be handled by the style).

In any case, I'm merging this now, because by separating text and sort format we gain flexibility if similar issues come up. Thanks!

fbennett commented 7 years ago

I has completely forgotten and had to check, but apparently citeproc-js strips quotes (both style-applied quotes="true" quotes, and quotes written in field content) when rendering sort keys.

Aside: In a fairly recent change (several months back), it also replaces spaces with hacked-in delimiters in order to achieve consistent sort ordering across JavaScript engines, each of which seems to break locale-based sorts in a slightly different way. It's been awhile and I don't remember the details, but I think the delimiters also break up the string to achieve a word-by-word sort. (The delimiter used depends on the result of a little sort test that the processor performs at instantiation.)

In Mozilla js24, the delimiter selected is @:

Simple@title@here@C@
Simple@title@here@A@
Simple@title@here@B@

In Rhino and v8, the delimiter selected is |:

Simple|title|here|C|
Simple|title|here|A|
Simple|title|here|B|
adam3smith commented 7 years ago

Yes, stripping quotes is correct for sorting according to CMoS (which is the only one I'm confident has rules on this).

On Wed, Oct 5, 2016 at 11:31 PM, Rintze M. Zelle notifications@github.com wrote:

The question is whether or not a macro should be rendered with a different format (e.g., one which suppresses quotes) when used for sorting.

I think quotes are typically ignored for sorting. @adam3smith https://github.com/adam3smith, do you know if any of the major style guides have an opinion on this? (also cc-ing @fbennett https://github.com/fbennett)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/inukshuk/citeproc-ruby/pull/43#issuecomment-251859064, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH32pM2P3LE12naHrkUxgKwO2NH-v_1ks5qxGuTgaJpZM4KPNmP .

Sebastian Karcher, PhD www.sebastiankarcher.com

inukshuk commented 7 years ago

@adam3smith @fbennet thanks, that's good to know!

Stripping away non-alphabetic symbols from values is something we could also add to the sort format relatively easily. But I would hope that sorting is otherwise stable across Ruby engines.