Permalink
Browse files

Preventing @string objects being passed to the renderer. (#170)

* Add failing test for bibtex string replacement with negative queries.

* Fix entries returing non-BibTeX::Entry objects.
  • Loading branch information...
1 parent aec36c9 commit 4b8c0f2f777866be3dedfa126ff51a7746df6533 @tom-jin tom-jin committed with Oct 3, 2016
Showing with 28 additions and 1 deletion.
  1. +27 −0 features/string.feature
  2. +1 −1 lib/jekyll/scholar/utilities.rb
@@ -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"
@@ -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

0 comments on commit 4b8c0f2

Please sign in to comment.