Commit c4de43c8 authored by Sylvester Keil's avatar Sylvester Keil

fix #55

this time add add tests to prove it
parent f974f763
......@@ -63,7 +63,7 @@ Feature: BibTeX
And the "_site/references.html" file should exist
And I should see "Look, an umlaut: ü!" in "_site/references.html"
@tags @bibtex @wip
@tags @bibtex
Scenario: Embedded BibTeX
Given I have a scholar configuration with:
| key | value |
......
......@@ -139,4 +139,48 @@ Feature: Details
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And the "_site/bibliography/ruby.html" file should exist
And I should see "<a[^>]+href=\"/bibliography/ruby.html\">" in "_site/scholar.html"
@tags @details @wip
Scenario: Links to Detail Pages Work With Pretty URLs
Given I have a configuration file with "permalink" set to "pretty"
And I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliogaphy | references |
| details_layout | details.html |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
<html>
<head></head>
<body>
{{ page.entry.title }}
</body>
</html>
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography %}
"""
When I run jekyll
Then the _site directory should exist
And I should see "pretty" in "_config.yml"
And the "_site/scholar/index.html" file should exist
And I should see "<a[^>]+href=\"/bibliography/ruby/index.html\">" in "_site/scholar/index.html"
And the "_site/bibliography/ruby/index.html" file should exist
......@@ -20,14 +20,14 @@ Given(/^I have an? "(.*)" file that contains "(.*)"$/) do |file, text|
end
Given(/^I have a configuration file with "(.*)" set to "(.*)"$/) do |key, value|
File.open('_config.yml', 'w') do |f|
File.open('_config.yml', 'a') do |f|
f.write("#{key}: #{value}\n")
f.close
end
end
Given(/^I have a configuration file with:$/) do |table|
File.open('_config.yml', 'w') do |f|
File.open('_config.yml', 'a') do |f|
table.hashes.each do |row|
f.write("#{row["key"]}: #{row["value"]}\n")
end
......
......@@ -9,17 +9,8 @@ Given(/^I have a (?:page|file) "([^"]*)":$/) do |file, string|
end
end
Given(/^I have a configuration file with "([^\"]*)" set to:$/) do |key, table|
File.open('_config.yml', 'w') do |f|
f.write("#{key}:\n")
table.hashes.each do |row|
f.write(" #{row["key"]}: #{row["value"]}\n")
end
end
end
Given(/^I have a scholar configuration with:$/) do |table|
File.open('_config.yml', 'w') do |f|
File.open('_config.yml', 'a') do |f|
f.write("scholar:\n")
table.hashes.each do |row|
f.write(" #{row["key"]}: #{row["value"]}\n")
......
......@@ -9,7 +9,8 @@ module Jekyll
@config = Scholar.defaults.merge(site.config['scholar'] || {})
@name = details_file_for(entry)
@name = entry.key.to_s.gsub(/[:\s]+/, '_')
@name << '.html'
process(@name)
read_yaml(File.join(base, '_layouts'), config['details_layout'])
......
......@@ -321,7 +321,7 @@ module Jekyll
name.gsub!(/[:\s]+/, '_')
if site.config['permalink'] == 'pretty'
name << 'index/index.html'
name << '/index.html'
else
name << '.html'
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