New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render date ranges #59

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@inukshuk
Owner

inukshuk commented Mar 13, 2018

Closes #58

end
def render_date_range(date, node, parts, delimiter)
delimit_range_at = 'day' # TODO date.delimit_range_at

This comment has been minimized.

@inukshuk

inukshuk Mar 13, 2018

Owner

This should be implemented in CiteProc::Date to return the he largest date part (“year”, “month”, or “day”) that differs between the two dates.

# @param date [CiteProc::Date]
# @param node [CSL::Style::DatePart, CSL::Locale::DatePart]
# @return [String]
def render_date_part(date, node)
def render_date_part(date, node, part: 0)

This comment has been minimized.

@inukshuk

inukshuk Mar 13, 2018

Owner

The signature of this could be changed to take a CiteProc::DatePart for date if seasons are rendered differently (see below)

end
when node.month?
case
# TODO support seasons in date parts!

This comment has been minimized.

@inukshuk

inukshuk Mar 13, 2018

Owner

Are season ranges even possible using CSL Data?

@jrochkind

This comment has been minimized.

Contributor

jrochkind commented Mar 20, 2018

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

This comment has been minimized.

Owner

inukshuk commented Mar 20, 2018

@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

This comment has been minimized.

Contributor

jrochkind commented Mar 20, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment