inukshuk / citeproc-ruby

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

Render date ranges #59

Open inukshuk opened 6 years ago

inukshuk commented 6 years ago

Closes #58

jrochkind commented 6 years ago

Hey @inukshuk , thanks for working on this! I had been trying, but I see looking at your code I wasn't even close to figuring out how to interact with the CSL nodes to do what was needed.

I think it's fine if it doesn't work for some edge cases -- prior to this, it didn't work at all, so.

However, I'm afraid it's not working for me for basic use cases.

I am trying with a csl-data-json object that has "issued":{"date-parts":[[1959], [1960]]} -- so a simple range, with just years. Which is the basic use case I need.

Running this through the chicago-note-bibliography style from csl-styles gem, I get dates output as: –1960. -- it's missing the opening of the range.

Trying other input with months and dates, it also is not working -- only including the end of range, and sometimes not including month/date from end of range as expected either.

inukshuk commented 6 years ago

@jrochkind yes, this is not fully functional yet; for starters, check out the TODO at line 41 above -- the delimit_range_at needs to be implemented in the date class (I think it makes sense to implement it there instead of here in the renderer). I just pushed the commits here, because you asked for how I would approach it and I figured it would be easier to explain by pushing the commit I already had. This is certainly not meant to be usable yet.

jrochkind commented 6 years ago

Ah, right on, thanks. Appreciate seeing the code.

I'll see if I can find time to take it further -- the fact that code needs to be split between two gems, which need to have their changes and releases synchronized... makes things harder. I wonder if it makes sense to temporarily or as fallback put the func in this gem?

I'll see if I can find time -- but I might end up just passing in a date with a literal I've formatted myself.