Skip to content

Commit

Permalink
Preventing @string objects being passed to the renderer. (#170)
Browse files Browse the repository at this point in the history
* Add failing test for bibtex string replacement with negative queries.

* Fix entries returing non-BibTeX::Entry objects.
  • Loading branch information
tom-jin authored and inukshuk committed Oct 3, 2016
1 parent aec36c9 commit 4b8c0f2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions features/string.feature
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,30 @@ Feature: String replacement
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 with queries involving negative conditions
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 --query !@article %}
"""
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"
2 changes: 1 addition & 1 deletion lib/jekyll/scholar/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def query
end

def entries
sort bibliography[query || config['query']]
sort bibliography[query || config['query']].select { |x| x.instance_of? BibTeX::Entry}
end

def offset
Expand Down

0 comments on commit 4b8c0f2

Please sign in to comment.