Commit 63c81f86 by Alex Gil

first commit

parents
service_name: travis-ci
Gemfile.lock
demo
**/*.swp
.bundle
coverage
.ruby-version
.DS_Store
SimpleCov.start do
add_filter 'features/'
end
language: ruby
bundler_args: --without debug
script: bundle exec rake test_with_coveralls
sudo: false
cache: bundler
rvm:
- 2.2.0
- 2.1.0
- 2.0.0
- rbx-2
notifications:
email:
recipients:
- sylvester@keil.or.at
on_success: change
on_failure: always
#matrix:
# allow_failures:
# - rvm: rbx-2
source 'https://rubygems.org'
gemspec
group :development do
if RUBY_VERSION.start_with?('2.2')
gem 'test-unit'
else
gem 'minitest', '< 5.0'
end
gem 'rake'
gem 'redgreen', '~> 1.2'
gem 'shoulda', '~> 3.5'
gem 'cucumber', '1.3.11'
gem 'redcarpet'
gem 'launchy', '~> 2.3'
gem 'unicode_utils'
gem 'simplecov', '~>0.9', :require => false
gem 'rubinius-coverage', :platform => :rbx
gem 'coveralls', :require => false
end
group :debug do
if RUBY_VERSION > '2.0'
gem 'byebug', '~>3.5', :require => false, :platform => :mri
else
gem 'debugger', '~>1.6', :require => false, :platform => [:mri_19, :mri_20]
end
gem 'rubinius-compiler', '~>2.0', :require => false, :platform => :rbx
gem 'rubinius-debugger', '~>2.0', :require => false, :platform => :rbx
end
(The MIT License)
Copyright (c) 2011-2013 Sylvester Keil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed. Click to expand it.
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jekyll/scholar/version'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features)
task :default => [:features]
require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :test_with_coveralls => [:features, 'coveralls:push']
task :release do |t|
system "gem build jekyll-scholar.gemspec"
system "git tag v#{Jekyll::Scholar::VERSION}"
system "git push --tags"
system "gem push jekyll-scholar-#{Jekyll::Scholar::VERSION}.gem"
end
default: --require features --color
\ No newline at end of file
Feature: BibTeX
As a scholar who likes to blog
I want to publish my BibTeX bibliography on my blog
In order to share my awesome references with my peers
@converters
Scenario: Simple Bibliography
Given I have a scholar configuration with:
| key | value |
| style | apa |
And I have a page "references.bib":
"""
---
---
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/references.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
Scenario: Markdown Formatted Bibliography
Given I have a scholar configuration with:
| key | value |
| style | apa |
And I have a page "references.bib":
"""
---
---
References
==========
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
When I run jekyll
Then I should see "<h1[^>]*>References</h1>" in "_site/references.html"
@latex
Scenario: Simple Bibliography with LaTeX directives
Given I have a scholar configuration with:
| key | value |
| style | apa |
And I have a page "references.bib":
"""
---
---
@misc{umlaut,
title = {Look, an umlaut: \"u!},
}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/references.html" file should exist
And I should see "Look, an umlaut: ü!" in "_site/references.html"
@tags @bibtex
Scenario: Embedded BibTeX
Given I have a scholar configuration with:
| key | value |
| style | apa |
And I have a page "references.md":
"""
---
---
References
==========
{% bibtex %}
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
{% endbibtex %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/references.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
@tags
Scenario: Simple Bibliography Loaded From Default Directory
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
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"
@tags @bibliography @config @template
Scenario: Simple Bibliography With Custom Template
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography_template | <abbr>{{index}} {{entry.type}} [{{key}}]</abbr>{{entry.author_1_last}} |
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 page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<abbr>1 book \[ruby\]</abbr>Matsumoto" in "_site/scholar.html"
@tags @filter
Scenario: Filtered Bibliography Loaded From Default Directory
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references --query @book[year <= 2000] %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
@tags @filter @variables
Scenario: Filter using interpolated query variable
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% assign yr = 2000 %}
{% bibliography -f references --query @book[year <= {{ yr }}] %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
@tags @bibliography @prefix
Scenario: A Prefixed Bibliography
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography --file references --prefix a -q @book[year <= 2000] %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should not see "ruby" in "_site/scholar.html"
And I should see "id=\"a-smalltalk\"" in "_site/scholar.html"
@tags @bibliography @style
Scenario: Simple Bibliography Loaded From Default Directory
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography --style modern-language-association %}
"""
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>. O’Reilly Media, 2008" in "_site/scholar.html"
@tags @bibliography @config @template
Scenario: Raw bibtex template
Given I have a scholar configuration with:
| key | value |
| bibliography_template | "{{entry.bibtex}}" |
| use_raw_bibtex_entry | true |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{ruby,
title = {The Ruby Programming Language}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography -f references %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "{%raw%}@book" in "_site/scholar.html"
Feature: Citations
As a scholar who likes to blog
I want to reference cool papers and books from my bibliography
@tags @cite_details
Scenario: A Simple Cite Details Link
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography | my_references |
And I have a "_bibliography" directory
And I have a file "_bibliography/my_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 page "scholar.html":
"""
---
---
{% cite_details ruby %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "Details</a>" in "_site/scholar.html"
@tags @bibliography @config @template @cite_details
Scenario: Raw bibtex template in details page
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography_template | {{entry.bibtex}} |
| details_layout | details.html |
| use_raw_bibtex_entry | true |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{a,
title = {{'b' | prepend: 'a'}}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
{{ page.entry.bibtex }}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/a.html" file should exist
And I should see "{{'b' | prepend: 'a'}}" in "_site/bibliography/a.html"
And I should not see "ab" in "_site/bibliography/a.html"
@tags @bibliography @config @template @cite_details
Scenario: Raw bibtex template in details page
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography_template | {{entry.bibtex}} |
| details_layout | details.html |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{a,
title = {{'b' | prepend: 'a'}}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
{{ page.entry.bibtex }}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/a.html" file should exist
And I should not see "{{'b' | prepend: 'a'}}" in "_site/bibliography/a.html"
And I should see "ab" in "_site/bibliography/a.html"
@tags @cite_details
Scenario: A Simple Cite Details Link With A Text Argument
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| bibliography | my_references |
And I have a "_bibliography" directory
And I have a file "_bibliography/my_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 page "scholar.html":
"""
---
---
{% cite_details ruby --text Click For More %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "Click For More</a>" in "_site/scholar.html"
Feature: Cited-only Bibliographies
As a scholar who likes to blog
I want to cite references on my website
And generate bibliographies for the cited items
Scenario: Cited-only references from a single bibliography
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% cite smalltalk %}
{% bibliography --cited %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
Scenario: No-cited items result in empty bibliography
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% bibliography --cited %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
And I should not see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
Scenario: Cited items with prefix
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":
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html":
"""
---
---
{% cite smalltalk %}
{% bibliography --cited --prefix one %}
{% cite ruby %}
{% bibliography --cited --prefix two %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "one-smalltalk" in "_site/scholar.html"
And I should see "two-ruby" in "_site/scholar.html"
And I should not see "one-ruby" in "_site/scholar.html"
And I should not see "two-smalltalk" in "_site/scholar.html"
Feature: Details
As a scholar who likes to blog
I want to publish my BibTeX bibliography on my blog
And I want Jekyll to generate detail pages for all the entries in my bibliography
@generators
Scenario: A bibliography with a single entry
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| 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},
comment = {A Comment},
publisher = {O'Reilly Media}
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
<html>
<head></head>
<body>
{{ page.title }}
{{ page.entry.comment }}
</body>
</html>
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/ruby.html" file should exist
And I should see "The Ruby Programming Language" in "_site/bibliography/ruby.html"
And I should see "A Comment" in "_site/bibliography/ruby.html"
@generators
Scenario: LaTeX conversion is applied to everything except the bibtex field
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| details_layout | details.html |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{ruby,
title = {An Umlaut \"a!},
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---
---
<html>
<head></head>
<body>
Title: {{ page.entry.title }}
{{ page.entry.bibtex }}
</body>
</html>
"""
When I run jekyll
Then the _site directory should exist
And the "_site/bibliography/ruby.html" file should exist
And I should see "Title: An Umlaut ä!" in "_site/bibliography/ruby.html"
And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"
@generators
Scenario: LaTeX conversion can be turned off
Given I have a scholar configuration with:
| key | value |
| source | ./_bibliography |
| details_layout | details.html |
| bibtex_filters | |
And I have a "_bibliography" directory
And I have a file "_bibliography/references.bib":
"""
@book{ruby,
title = {An Umlaut \"a!},
}
"""
And I have a "_layouts" directory
And I have a file "_layouts/details.html":
"""
---