Commit 63c81f86 authored by Alex Gil's avatar Alex Gil
Browse files

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.
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
Scenario: A Simple Citation
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 ruby %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "Flanagan" in "_site/scholar.html"
@tags @cite @suppress-author
Scenario: Citations With Suppressed Author
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 ruby --suppress_author %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "2008" in "_site/scholar.html"
And I should not see "Flanagan" in "_site/scholar.html"
@tags @cite
Scenario: Missing references
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 java %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "missing reference" in "_site/scholar.html"
@tags @quote
Scenario: A Simple Block-Quote
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":
"""
---
---
{% quote ruby %}
We <3 Ruby
{% endquote %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "<blockquote><p>We <3 Ruby</p><cite><a .*#ruby.+\(Flanagan" in "_site/scholar.html"
@tags @cite
Scenario: A prefixed citation
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 ruby --prefix a %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "#a-ruby" in "_site/scholar.html"
@tags @cite
Scenario: Multiple Citations
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}
}
@book{microscope,
title = {Ruby Under a Microscope},
author = {Pat Shaughnessy},
year = {2013},
publisher = {No Starch Press}
}
"""
And I have a page "scholar.html":
"""
---
---
{% cite ruby microscope %}
"""
When I run jekyll
Then the _site directory should exist
And the "_site/scholar.html" file should exist
And I should see "Flanagan &amp; Matsumoto, 2008; Shaughnessy, 2013" in "_site/scholar.html"
@tags @cite @locator
Scenario: Multiple Citations with locators
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}
}
@book{microscope,
title = {Ruby Under a Microscope},
author = {Pat Shaughnessy},
year = {2013},
publisher = {No Starch Press}
}
"""
And I have a page "scholar.html":
"""
---
---
{% cite ruby microscope -l 2-3 --locator 23 & 42 %}
"""
When I run jekyll
Then the _site directory should exist