Juris-M / citeproc-js

A JavaScript implementation of the Citation Style Language (CSL) https://citeproc-js.readthedocs.io
Other
304 stars 84 forks source link

No comma after question mark and exlamation mark #154

Open georgd opened 3 years ago

georgd commented 3 years ago

Another specialty from Austria : If a title ends in a question mark or an exclamation mark, no comma should be inserted after the mark.

I know, this is a hairy thing. It would be great if there were a switch for that. But I think, there are no plans to make this parametrisable?

denismaier commented 3 years ago

Shouldn't that be discussed on the CSL schema issue tracker. Don't think it would be good to implement this in citeproc-js only.

fbennett commented 3 years ago

This one would not be hard to address. citeproc-js has a punctuation table that controls merging, suppression, and migration of adjacent punctuation. Other implementations will need something similar. https://github.com/Juris-M/citeproc-js/blob/master/src/queue.js#L724 (In the case of citeproc-js, it looks like it could be done by applying inline conditions at lines 729 and 736.)

(Edit: Agree with @denismaier that agreement at CSL would be a good thing.)

georgd commented 3 years ago

This one would not be hard to address. citeproc-js has a punctuation table that controls merging, suppression, and migration of adjacent punctuation. Other implementations will need something similar. https://github.com/Juris-M/citeproc-js/blob/master/src/queue.js#L724 (In the case of citeproc-js, it looks like it could be done by applying inline conditions at lines 729 and 736.)

I thought so, but in this case, a per-style configurability is needed because in many styles, the current behaviour is definitely correct.

(Edit: Agree with @denismaier that agreement at CSL would be a good thing.)

Fine. @denismaier this is probably for the 1.1 branch? And the way to go would be to get an agreement there, implement as part of CSLm and port it to vanilla CSL when 1.1 will be implemented?

denismaier commented 3 years ago

Ok, I see basically two options: If we can find a general pattern this can just be baked into the processor logic and we can get away with an "implementation addendum" in the documentation. If this needs to be configurable on a per style basis, maybe we'd need a new locale element? Like so:

<punct-handling>
  <punct>
    <input value="?,"/>
    <output value="?"/>
  </punct>
</punct-handling>

Perhaps this is closer to how it looks in citeproc-js:

<punct-handling>
  <punct value="?">
    <next value="!" result="?!"/>
    <next value="." result="?"/>
    <next value=":" result="?"/>
    <next value="," result="?,"/>
    <next value=";" result="?;"/>
  </punct>
</punct-handling>

We can take the combinations from citeproc-js as a basis for here if we can agree upon a syntax. I think CSL 1.1 is a good target for this. But perhaps we can even add it to 1.0.2 as this just makes the current behaviour explicit and configurable. (Well, we'd need to check how this works in other implementations, of course. @jgm How does that work in your new citeproc library?)

denismaier commented 3 years ago

Ok. The new Haskell citeproc is on track. Thanks @jgm.