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

Prevent month normalization for entry.bibtex #82

Closed
goodmami opened this issue May 10, 2015 · 4 comments
Closed

Prevent month normalization for entry.bibtex #82

goodmami opened this issue May 10, 2015 · 4 comments

Comments

@goodmami
Copy link

Hi, thanks for Jekyll-Scholar!

I want to display the raw bibtex entry in the Details pages via entry.bibtex, but it seems the month field is being modified.

I understand that it's best for some normalization to take place, such as @string replacement and filtering out certain fields (like "month_numeric" and maybe "abstract"), but months (like "August") are getting replaced with abbreviations (like "aug"). Now, if the abbreviations were outside of quotes or braces (e.g. month = aug,), then it would be the string macro for the month, and that's not the worst outcome, but it is inside braces in my case, so it's just the string "aug".

Here's the relevant part of the bibtex entry:

  month     = {August},

And here's the result when I use entry.bibtex in Jekyll:

  month = {aug},

I tried adding this to _config.yml to override the default, but it did nothing:

scholar:
  bibtex_options:
    parse_months: false

The best situation for me is to have entry.bibtex be the original bibtex entry without any normalization (except string replacements and/or filtering, though I believe these two things are already configurable). The normalized version should then be available from entry.month, so that Jekyll-Scholar can use it.

Is this currently possible? In general I'd be happy to provide a PR with a fix, but I'm new to Ruby. I see the entry.bibtex object is created in liquidify() of utilities.rb, but I'm guessing bibtex-ruby itself doesn't store the original bibtex source after parsing it, so maybe it's not even available to jekyll-scholar?

@inukshuk
Copy link
Owner

Just for context, the reason we're parsing the months is mostly for reasons of sorting (see #69 #72 #74 #77 for example) by date, so if you do not rely on this you're probably fine with switching off month parsing.

I'll take a look to see why switching off month parsing didn't work and report back. You're also right that month parsing in BibTeX is supposed to set the month to symbol not a string.

Meanwhile, you can also add additional keys to your bibtex file (like month_string or something like that) and those keys should be exposed to your template. (But this obviously involves additional overhead).

inukshuk added a commit that referenced this issue May 10, 2015
inukshuk added a commit that referenced this issue May 10, 2015
@inukshuk
Copy link
Owner

If you install version 4.3.6 it should pull in a version of BibTeX-Ruby which prints the month macros correctly (i.e., month = aug) and fixes the parsing of bibtex_options (i.e., you can turn off month parsing in _config.yml). Hope this helps, and thanks for reporting!

@inukshuk
Copy link
Owner

(Oh, and PRs are much appreciated of course)

@goodmami
Copy link
Author

That was very quick! Thank you. The new version works for me as described.

It addresses the immediate issue of the quoted month macros and broken parse_months option, but eventually it would be nice to have the more general behavior where entry.bibtex returns the (mostly) unaltered string, while entry.XYZ returns the parsed form of XYZ (and is used for sorting, etc). If I find a spare moment I can try and learn enough Ruby make such a patch, but for now your current fix allows me to move forward. Thanks again!

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