Closed DerDrodt closed 4 months ago
I share your preference to keep the user-specified separator. With Hayagriva's new test allow-list, we can explicitly opt out of some of citeproc's tests.
I see the boundary between citationberg
and hayagriva
as follows: The former implements CSL features in a way that does not make assumptions about the data we want to format while hayagriva
comes with its own data model and the implementation needed to format it. I think that parsing our user input is still format-specific and should be handled in hayagriva
. Do you agree?
I share your preference to keep the user-specified separator. With Hayagriva's new test allow-list, we can explicitly opt out of some of citeproc's tests.
That makes sense. In that case, we should have our own tests in the same format to test the new behavior.
I also found that according to the CSL docs we should only replace hyphens if the attribute was set. There also is no mention of a default for page-range-format
. Should we remove our default?
I see the boundary between
citationberg
andhayagriva
as follows: The former implements CSL features in a way that does not make assumptions about the data we want to format whilehayagriva
comes with its own data model and the implementation needed to format it. I think that parsing our user input is still format-specific and should be handled inhayagriva
. Do you agree?
I agree. My proposal is this:
1-5, 6-12 & 18
is turned to [1-5, 6-12, 18]
.That seems to be the desired behavior.
I apologize for my late answer! If the CSL spec does not want us to remove hyphens if the attribute isn't set we shall not. I think that the page-range-format
default, however, should be kept as styles may rely on it given that citeproc.js
is the biggest CSL consumer.
Your proposal looks good to me!
I updated this PR. I am preparing a PR for hayagriva. When this is merged, I can use it in hayagriva to incorporate the things we discussed.
Thank you! Do you need a breaking citationberg release right away or do we expect more changes?
No need for a new release. It is already set to use the git repo.
(This is a big change; I apologize.)
This PR changes formatting of page ranges entirely. In summary
PageRangeFormat::format
no longer acceptsstart
andend
parameters of typei32
but&str
to handle prefixes better.8n11564-8n1568
is formatted to8n11564–68
by Chicago15. (The prefix must be identical for start and end of the range!)I followed the Haskell implementation of pandoc pretty closely, while trying to be as efficient as possible and writing it like one would in Rust. I would not be surprised if it can be optimized further.
Three points should be cleared up before merging:
123N110 - N5
is turned to123N110-N5
byExpanded
(note that no en-dash is used!). I would prefer the given separator instead of the normal dash. This is a matter of taste. Answer: We should use the given separator.Library
expose the structure of the ranges without rendering using CSL or should it be seen as part of CSL? Answer: See comment below.page-range-format
? Answer: no.~This would be the second API change to citationberg. If merged, we should have a new version.~