Skip to content
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

empty month #77

Closed
andrewning opened this issue Jan 19, 2015 · 5 comments
Closed

empty month #77

andrewning opened this issue Jan 19, 2015 · 5 comments

Comments

@andrewning
Copy link

The year/month sort works great. However, it would be great if it could handle references with no month information. Currently, it crashes in those cases so I have to put in a fake month. I use this for references that are either in review or in press and so don't yet have a publication month. Ideally, I'd like them to map to a month_numeric of 13 so that they appeared as the most recent publications.

@inukshuk
Copy link
Owner

I tried to solve this on the cheap, but I guess we'll have to do better. The underlying issue is that our values will typically be strings and sometimes numbers. Currently we're simply comparing the raw values, but I think we should compare the BibTeX::Value objects instead -- making sure that comparison operation works well with those. BibTeX::Values already distinguish between numeric and string values (and other more complex BibTeX values like compound strings or variable names).

However, the problem remains that most would expect nil values to come before values when sorting (at least in Ruby nil.to_i becomes zero and nil.to_s becomes '') whereas you would like it to come last. Easier than trying to tackle this generically (which would probably mean introducing a new configuration option etc.) I would suggest you simply patch the sorting method accordingly. I can help you do that if you like.

@andrewning
Copy link
Author

ok. sounds like there is not an easy fix for this. I'm just going to add the month when it started in review or in press and I'm fine with that.

inukshuk added a commit that referenced this issue Jan 20, 2015
@inukshuk
Copy link
Owner

The comparision logic should be improved now in that it compares numerically if both values look numeric and otherwise converts to string. This means that nil should work now, too, but, in the case of months for example it would compare december and nil as "12" and "" respectively.

@andrewning
Copy link
Author

This one still gives me problems if I put in a blank month.  But I’ve been putting in months anyway so not a big deal.

On Tue, Jan 20, 2015 at 6:27 AM, Sylvester Keil notifications@github.com
wrote:

The comparision logic should be improved now in that it compares numerically if both values look numeric and otherwise converts to string. This means that nil should work now, too, but, in the case of months for example it would compare december and nil as "12" and "" respectively.

Reply to this email directly or view it on GitHub:
#77 (comment)

inukshuk added a commit that referenced this issue Jan 21, 2015
@inukshuk
Copy link
Owner

You're right, comparisons still fail if the left hand value is nil. This should be fixed now (at last).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants