diff --git a/features/bibtex.feature b/features/bibtex.feature index 7a6c98dc09e942b82e92fccd5cbe58578271fccf..cca501004631e58fdef7f412e46c7667dc8bec62 100644 --- a/features/bibtex.feature +++ b/features/bibtex.feature @@ -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 | diff --git a/features/details.feature b/features/details.feature index 48847024c76a13e5aba48133bb6f3a7d5dbc46fb..0b7eff9579f5fcf536c1956d6bd56838ba8266bb 100644 --- a/features/details.feature +++ b/features/details.feature @@ -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 "]+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": + """ + --- + --- + + + + {{ page.entry.title }} + + + """ + 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 "]+href=\"/bibliography/ruby/index.html\">" in "_site/scholar/index.html" + And the "_site/bibliography/ruby/index.html" file should exist diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 20fef1b57d55bfd8891ea34bb9f027ef3817753a..866bc21fae2380d18adbea4ac34b633f315fabb4 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -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 diff --git a/features/step_definitions/scholar_steps.rb b/features/step_definitions/scholar_steps.rb index 7cac358c95f184740c10f43a8814e9ce4b428302..059fa5694e9d2eaf578c27109a4748fc2c016eec 100644 --- a/features/step_definitions/scholar_steps.rb +++ b/features/step_definitions/scholar_steps.rb @@ -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") diff --git a/lib/jekyll/scholar/generators/details.rb b/lib/jekyll/scholar/generators/details.rb index c77581f384e2fa45aab4a7d8ae27ec2f5ead4232..24c762496e61733dc00819f7b755c681790edee2 100644 --- a/lib/jekyll/scholar/generators/details.rb +++ b/lib/jekyll/scholar/generators/details.rb @@ -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']) diff --git a/lib/jekyll/scholar/utilities.rb b/lib/jekyll/scholar/utilities.rb index 5c8fbefd49097fe615f6ffc4261b84693d7ca1eb..08b8c88fe9b3142c73439e7446b97ecce9442853 100644 --- a/lib/jekyll/scholar/utilities.rb +++ b/lib/jekyll/scholar/utilities.rb @@ -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