Commit f9d40aa5 authored by Sylvester Keil's avatar Sylvester Keil

expose all name fields individually to templates

fixes #112
parent 855a8826
...@@ -115,12 +115,12 @@ Feature: BibTeX ...@@ -115,12 +115,12 @@ Feature: BibTeX
And the "_site/scholar.html" file should exist And the "_site/scholar.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html" And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
@tags @bibliography @config @tags @bibliography @config @template
Scenario: Simple Bibliography With Custom Template Scenario: Simple Bibliography With Custom Template
Given I have a scholar configuration with: Given I have a scholar configuration with:
| key | value | | key | value |
| source | ./_bibliography | | source | ./_bibliography |
| bibliography_template | <abbr>{{index}} {{entry.type}} [{{key}}]</abbr>{{reference}} | | bibliography_template | <abbr>{{index}} {{entry.type}} [{{key}}]</abbr>{{entry.author_1_last}} |
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":
""" """
...@@ -140,8 +140,7 @@ Feature: BibTeX ...@@ -140,8 +140,7 @@ Feature: BibTeX
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
And the "_site/scholar.html" file should exist And the "_site/scholar.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html" And I should see "<abbr>1 book \[ruby\]</abbr>Matsumoto" in "_site/scholar.html"
And I should see "<abbr>1 book \[ruby\]</abbr><span" in "_site/scholar.html"
@tags @filter @tags @filter
Scenario: Filtered Bibliography Loaded From Default Directory Scenario: Filtered Bibliography Loaded From Default Directory
......
...@@ -325,6 +325,14 @@ module Jekyll ...@@ -325,6 +325,14 @@ module Jekyll
entry.fields.each do |key, value| entry.fields.each do |key, value|
value = value.convert(*bibtex_filters) unless bibtex_filters.empty? value = value.convert(*bibtex_filters) unless bibtex_filters.empty?
e[key.to_s] = value.to_s e[key.to_s] = value.to_s
if value.is_a?(BibTeX::Names)
value.each.with_index do |name, idx|
name.each_pair do |k, v|
e["#{key}_#{idx}_#{k}"] = v.to_s
end
end
end
end end
e e
......
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