inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.13k stars 101 forks source link

"urldate" not rendered in "Online" references #296

Closed schuam closed 4 years ago

schuam commented 4 years ago

Hello Silvester!

I've been using Jekyll-Scholar for a while now and I like it a lot. Thanks for creating it. Now I have a problem, and was hoping you could tell me how to fix it.

I don't really use bibtex, but biblatex. So far that hasn't been a problem, but now I want to cite references of type "Online", which exists in biblatex. An example reference in my biblatex file looks like the following:

@Online{test_reference,
  author    = {Test Author},
  title     = {Test Title},
  url       = {http://www.test.de},
  date      = {1999-01-01},
  urldate   = {2020-04-13},
}

As citation style I use IEEE. Since it didn't include Online, I just added it to the website section of the part of the ieee.csl file.

<else-if type="webpage post-weblog online" match="any">
    <group delimiter=", " suffix=". ">
    <text macro="title"/>
    <text variable="container-title" font-style="italic"/>
    <text macro="issued"/>
    </group>
    <text macro="access"/>
</else-if>

The issued and the access macros have the following sections.

<date variable="issued">
  <date-part name="day" form="numeric-leading-zeros" suffix="-"/>
  <date-part name="month" form="short" suffix="-" strip-periods="true"/>
  <date-part name="year" form="long"/>
</date>
<date variable="accessed">
  <date-part name="day" form="numeric-leading-zeros" suffix="-"/>
  <date-part name="month" form="short" suffix="-" strip-periods="true"/>
  <date-part name="year" form="long"/>
</date>

Now there are two issues. The first one makes me wonder a little bit, the second has caused my a quite a bit of trouble and I just can't figure out how to fix it.

1) The date in my biblatex reference is rendered as the issued date in the issued macro. I'm wondering why that is the case, but since I actually want that, it's fine. This way, I don't have to make any further adaptations for it. 2) Since my Online references don't have an access date. I tried changing the access date part in the csl file to . Restarting jekyll causes an error now. The --trace flag revealed that following (well there is more output, but I think the important part are these calls):

4: from /var/lib/gems/2.5.0/gems/csl-1.5.1/lib/csl/treelike.rb:22:in `each_child'

3: from /var/lib/gems/2.5.0/gems/csl-1.5.1/lib/csl/treelike.rb:22:in `each'

2: from /var/lib/gems/2.5.0/gems/citeproc-ruby-1.1.12/lib/citeproc/ruby/renderer/group.rb:17:in `block in render_group'

1: from /var/lib/gems/2.5.0/gems/citeproc-ruby-1.1.12/lib/citeproc/ruby/renderer.rb:46:in render' /var/lib/gems/2.5.0/gems/citeproc-ruby-1.1.12/lib/citeproc/ruby/renderer/date.rb:16:inrender_date': undefined method `literal?' for #<CiteProc::Variable "2020-04-10"> (NoMethodError)

I digged a little deeper and came across the file schema.rb in the gem csl-1.5.1. But adding urldate to the following didn't help either.

@variables = Hash.new { |h,k| h.fetch(k.to_sym, nil) }.merge({ :date => %w{ accessed container event-date issued original-date submitted },

Since I've never done anything in Ruby myself, I don't really know what I should do next. Any ideas?

inukshuk commented 4 years ago

Good detective work: I think the problem is that urldate should automatically be converted to accessed (and converted into a CSL date object). I've pushed an update to the bibtex-ruby gem. Can you try again after installing version 5.1.4 of that gem?

schuam commented 4 years ago

Wow, that was fast! I updated the bibtex-rugy gem and now it works. Thanks a lot for fixing it.