Commit b02ed5d9 by JoostvanPinxten Committed by Sylvester Keil

Process bibliography tag in the same way as the details page generator (#167)

* Add test for raw bibtex entries on the details page. It currently fails as the details generator does not get passed through the liquidify utility, but instead is passed to liquid parser immediately. * Fix the issue that the bibliography tag is rendered differently on the details page than in the bibliography tag. They should now behave (more or less) in the same way.
parent 5415f32e
......@@ -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"
......@@ -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":
"""
---
---
<html>
<head></head>
<body>
{%bibliography%}
</body>
</html>
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
<html>
<head></head>
<body>
Page title: {{ page.title }}
Title: {{ page.entry.title }}
{{ page.entry.bibtex }}
</body>
</html>
"""
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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment