diff --git a/features/bibtex.feature b/features/bibtex.feature index 1ec7c578a452e224c610b9e6a1d3bb486afe52b2..3b4caa90f821e1c43bd195ce201c3ab01a4a9646 100644 --- a/features/bibtex.feature +++ b/features/bibtex.feature @@ -368,4 +368,4 @@ Feature: BibTeX When I run jekyll Then the _site directory should exist And the "_site/scholar.html" file should exist - And I should see "{%raw%}@book" in "_site/scholar.html" + And I should not see "{%[\w*]raw[\w*]%}" in "_site/scholar.html" diff --git a/features/details.feature b/features/details.feature index b71e1856e432fe996047f09deab17c3f4b9c05f8..9ab14e57753f19b0c947309c0eef0e387810b2ce 100644 --- a/features/details.feature +++ b/features/details.feature @@ -107,6 +107,53 @@ Feature: Details And I should see "Page title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html" And I should see "Title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html" And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html" + + + @generators + Scenario: Raw input can be turned on, but should not generate any {%raw%} tags on the details page, and also not parse the liquid tags inside the bibtex + Given I have a scholar configuration with: + | key | value | + | source | ./_bibliography | + | details_layout | details.html | + | bibtex_filters | | + | use_raw_bibtex_entry | true | + And I have a "_bibliography" directory + And I have a file "_bibliography/references.bib": + """ + @book{sdf, + title = {{SDF^3}} + } + """ + And I have a file "bibliography.html": + """ + --- + --- + + + + {%bibliography%} + + + """ + And I have a "_layouts" directory + And I have a file "_layouts/details.html": + """ + --- + --- + + + + Page title: {{ page.title }} + Title: {{ page.entry.title }} + {{ page.entry.bibtex }} + + + """ + When I run jekyll + Then the _site directory should exist + And the "_site/bibliography/sdf.html" file should exist + And I should not see "{%raw%}" in "_site/bibliography/sdf.html" + And I should see "SDF\^3" in "_site/bibliography/sdf.html" @tags @details Scenario: Links to Detail Pages are Generated Automatically diff --git a/lib/jekyll/scholar/utilities.rb b/lib/jekyll/scholar/utilities.rb index b168230a0bf0fe1aafe197f07ff0d2bd258d6409..fd25b5b080a127f8e521a0851015ec42d6d3fc84 100644 --- a/lib/jekyll/scholar/utilities.rb +++ b/lib/jekyll/scholar/utilities.rb @@ -455,8 +455,8 @@ module Jekyll def bibliography_tag(entry, index) return missing_reference unless entry - - liquid_template.render( + + tmp = liquid_template.render( reference_data(entry,index) .merge(site.site_payload) .merge({ @@ -468,6 +468,15 @@ module Jekyll :filters => [Jekyll::Filters] } ) + # process the generated reference with Liquid, to get the same behaviour as + # when it is used on a page + Liquid::Template.parse(tmp).render( + site.site_payload, + { + :registers => { :site => site }, + :filters => [Jekyll::Filters] + } + ) end def reference_data(entry, index = nil)