Commit 80b1fe04 authored by Sylvester Keil's avatar Sylvester Keil

Merge pull request #43 from mdave/master

Enable support for joining strings
parents 733e79b2 4c7dbaa3
......@@ -43,6 +43,7 @@ default configuration is as follows:
bibliography_template: "{{reference}}"
replace_strings: true
join_strings: true
details_dir: bibliography
details_layout: bibtex.html
......
Feature: String replacement
As a scholar who likes to blog
I want to publish my BibTeX bibliography on my blog
And make sure that strings are correctly substituted
@tags @string
Scenario: String replacement
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@string{ rubypl = "The Ruby Programming Language" }
@book{ruby,
title = rubypl,
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
@tags @string
Scenario: String replacement disabled
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| replace_strings | false |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@string{ rubypl = "The Ruby Programming Language" }
@book{ruby,
title = rubypl,
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<i>rubypl</i>" in "_site/scholar.html"
@tags @string
Scenario: Join strings
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@string{ ruby = "Ruby" }
@book{ruby,
title = "The " # ruby # " Programming Language",
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
@tags @string
Scenario: Join strings disabled
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| join_strings | false |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@string{ ruby = "Ruby" }
@book{ruby,
title = "The " # ruby # " Programming Language",
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<i>\"The \" # \"Ruby\" # \" Programming Language\"</i>" in "_site/scholar.html"
......@@ -15,6 +15,7 @@ module Jekyll
'bibtex_filters' => [ :latex ],
'replace_strings' => true,
'join_strings' => true,
'details_dir' => 'bibliography',
'details_layout' => 'bibtex.html',
......
......@@ -109,6 +109,7 @@ module Jekyll
bibtex_options
)
@bibliography.replace_strings if replace_strings?
@bibliography.join if join_strings? && replace_strings?
end
@bibliography
......@@ -149,6 +150,10 @@ module Jekyll
config['replace_strings']
end
def join_strings?
config['join_strings']
end
def cited_only?
!!@cited
end
......
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