Commit 2ce8e1c9 authored by Sylvester Keil's avatar Sylvester Keil

Merge pull request #119 from JoostvanPinxten/master

Add global option to allow for raw bibtex entries in the reference blocks and cite_detail pages
parents d072f25b 7e0e9e8f
...@@ -55,6 +55,8 @@ default configuration is as follows: ...@@ -55,6 +55,8 @@ default configuration is as follows:
replace_strings: true replace_strings: true
join_strings: true join_strings: true
use_raw_bibtex_entry: false
details_dir: bibliography details_dir: bibliography
details_layout: bibtex.html details_layout: bibtex.html
...@@ -76,6 +78,10 @@ The `source` option indicates where your bibliographies are stored; ...@@ -76,6 +78,10 @@ The `source` option indicates where your bibliographies are stored;
`bibliography` is the name of your default bibliography. For best results, `bibliography` is the name of your default bibliography. For best results,
please ensure that your Bibliography is encoded as ASCII or UTF-8. please ensure that your Bibliography is encoded as ASCII or UTF-8.
The `use_raw_bibtex_entry` option will disable parsing of Liquid tags that
are embedded in the Bibtex fields. This option provides a way to circumvent
the problem that the double braces functionality of BibTex is accidentally
parsed by Liquid, while it was intended to keep the exact capitalization style.
### Bibliographies ### Bibliographies
......
...@@ -276,6 +276,7 @@ Feature: BibTeX ...@@ -276,6 +276,7 @@ Feature: BibTeX
Given I have a scholar configuration with: Given I have a scholar configuration with:
| key | value | | key | value |
| bibliography_template | "{{entry.bibtex}}" | | bibliography_template | "{{entry.bibtex}}" |
| use_raw_bibtex_entry | true |
And I have a "_bibliography" directory And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib": And I have a file "_bibliography/references.bib":
""" """
...@@ -287,7 +288,7 @@ Feature: BibTeX ...@@ -287,7 +288,7 @@ Feature: BibTeX
""" """
--- ---
--- ---
{% bibliography -f references --raw_bibtex %} {% bibliography -f references %}
""" """
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
......
...@@ -29,6 +29,63 @@ Feature: Citations ...@@ -29,6 +29,63 @@ Feature: Citations
And the "_site/scholar.html" file should exist And the "_site/scholar.html" file should exist
And I should see "Details</a>" in "_site/scholar.html" And I should see "Details</a>" in "_site/scholar.html"
@tags @bibliography @config @template @cite_details
Scenario: Raw bibtex template in details page
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography_template | {{entry.bibtex}} |
| details_layout | details.html |
| use_raw_bibtex_entry | true |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{a,
title = {{'b' | prepend: 'a'}}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
{{ page.entry.bibtex }}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/a.html" file should exist
And I should see "{{'b' | prepend: 'a'}}" in "_site/bibliography/a.html"
And I should not see "ab" in "_site/bibliography/a.html"
@tags @bibliography @config @template @cite_details
Scenario: Raw bibtex template in details page
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography_template | {{entry.bibtex}} |
| details_layout | details.html |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{a,
title = {{'b' | prepend: 'a'}}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
{{ page.entry.bibtex }}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/a.html" file should exist
And I should not see "{{'b' | prepend: 'a'}}" in "_site/bibliography/a.html"
And I should see "ab" in "_site/bibliography/a.html"
@tags @cite_details @tags @cite_details
Scenario: A Simple Cite Details Link With A Text Argument Scenario: A Simple Cite Details Link With A Text Argument
Given I have a scholar configuration with: Given I have a scholar configuration with:
......
...@@ -23,6 +23,7 @@ module Jekyll ...@@ -23,6 +23,7 @@ module Jekyll
'details_dir' => 'bibliography', 'details_dir' => 'bibliography',
'details_layout' => 'bibtex.html', 'details_layout' => 'bibtex.html',
'details_link' => 'Details', 'details_link' => 'Details',
'use_raw_bibtex_entry' => false,
'bibliography_class' => 'bibliography', 'bibliography_class' => 'bibliography',
'bibliography_template' => '{{reference}}', 'bibliography_template' => '{{reference}}',
......
...@@ -80,13 +80,9 @@ module Jekyll ...@@ -80,13 +80,9 @@ module Jekyll
opts.on('-T', '--template TEMPLATE') do |template| opts.on('-T', '--template TEMPLATE') do |template|
@bibliography_template = template @bibliography_template = template
end end
opts.on('-R', '--raw_bibtex') do |raw_bibtex|
@raw_bibtex = raw_bibtex
end
end end
argv = arguments.split(/(\B-[cCfqptTslomAR]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|offset|max|suppress_author|raw_bibtex|))/) argv = arguments.split(/(\B-[cCfqptTslomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|offset|max|suppress_author|))/)
parser.parse argv.map(&:strip).reject(&:empty?) parser.parse argv.map(&:strip).reject(&:empty?)
end end
...@@ -182,7 +178,7 @@ module Jekyll ...@@ -182,7 +178,7 @@ module Jekyll
end end
def raw_bibtex? def raw_bibtex?
!!@raw_bibtex config['use_raw_bibtex_entry']
end end
def repository? def repository?
......
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