inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.12k stars 102 forks source link

refer to page attributes in bibliography query ? #280

Open maxandersen opened 4 years ago

maxandersen commented 4 years ago

I'm using my bib files as kinda a bookmark system and would like to write a blog post on a regular basis and then just pass a page attribute to --query.

What I'm trying to do is this:

          {% if page.bibquery %}
          {% bibliography --query @*[page.bibquery}] %}
          {% endif %}

And then in a post I'll have a attribute like:

bibquery = date ^= 2019-09

to get anything found with date matching 2019-09 to get all of September's findings.

other times the query would be a mix of fields thus the solution at https://github.com/inukshuk/jekyll-scholar/issues/50 isn't working for me.

inukshuk commented 4 years ago

It's been a long time since I used jekyll/liquid myself, so I'm not sure what page attributes are. The interpolation should resolve page variables (I just added a test case to make sure), so I would think it should be relatively easy to resolve attributes too, if we know where to look for them.

maxandersen commented 4 years ago

your test does this: {% bibliography --query @book[year >= {{page.year_from}} && year <= {{to}}] %}

what I'm looking for is being able todo is this:

{% bibliography --query {{page.bibquery}} %}

inukshuk commented 4 years ago

This should also work, see here.

maxandersen commented 4 years ago

hmm - I could not get that to work. Always returned blank. I'll try again.

maxandersen commented 4 years ago

tried again and I figured out what was causing it.

bibquery: "@*[date <= 2019-09-22]"

works.

bibquery: "@*[date <= '2019-09-22']"

does not.

somehow the quote content got ignored but was not erroring.

maxandersen commented 4 years ago

thanks for looking :)

maxandersen commented 4 years ago

okey, this is actually not working.

Using this .bib file: https://github.com/quarkusio/quarkusio.github.io/blob/develop/_bibliography/publications.bib

@*[date <= 2019-04-01] returns all entries even those with a higher date. @*[date <= 2019-11-01] returns same as the above event though it definitely should not. @*[date >= 2019-12-01] returns all too.

its as if it just check that date attribute exist.

also I have custom attribute urldate and using that in the query returns no results.

inukshuk commented 4 years ago

Can you try with jekyll-scholar 6.4.0 and bibtex-ruby 5.0.1?

mr-pranay commented 1 month ago

@book{ruby, title = {The Ruby Programming Language}, author = {Flanagan, David and Matsumoto, Yukihiro}, year = {2008}, publisher = {O'Reilly Media} }

entry.bibtex will give entire entry , but i need specific fields to be displayed . How to do that . More clearly i need only title and author but not year and publisher. How to filter it ?