middleman-bibtex 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ff6fe964a5ccd8a05631292e2dbc857a4243905
4
- data.tar.gz: d13b7b387814f4b5323e39e8c5d5bf678fe4cfbb
3
+ metadata.gz: c2ac6239addeb2128a322dd296e5d79ab28e8ad4
4
+ data.tar.gz: 08f3abbd71dc8ac93b6709eb491c3a4511c4dda8
5
5
  SHA512:
6
- metadata.gz: d154bc92c8afca1c20ce1277e284f4966940840d26249dde1527fb4fc0fca7917e8a37522112b8bbc47c3f3cf3eba08bc5e2021f97fdcb4db8f68ed4ca615ebb
7
- data.tar.gz: ee6a44df880ec527107be6c5995b051eeb10605b28dab3029a64cc8e114bbc4eb26f21265480d7c091f9de5e4f169155143b93e85470a6683fda4ebcf3e6e6a3
6
+ metadata.gz: d8b5256f2774f928cec0b9a881a9ae6c91468287ff21241b0215ac686bd8df558e1df047a65b82e160abde2a15af444994df22e7b1be366d1c9a9fb924bd7559
7
+ data.tar.gz: 3c06670013456ed50c9a34960292e908ffc90344b8789215384a901d84c4d5f2cc7d30268bd0360599c82e22d3143d09a7636e6a460713d2f9aba78d114d70cd
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  pkg
2
+ Gemfile.lock
@@ -1,6 +1,6 @@
1
1
  module Middleman
2
2
  module Bibtex
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  class KeyNotFound < RuntimeError ; end
5
5
  end
6
6
  end
@@ -8,11 +8,10 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['J. J. Green']
9
9
  spec.email = ['j.j.green@gmx.co.uk']
10
10
  spec.description = <<-EOF
11
- A middleman extension that gives helpers for
12
- creating bibtex citation, a fork from the
13
- middleman-citation extension.
11
+ A middleman extension for BibTeX bibliographies,
12
+ a fork of the middleman-citation extension.
14
13
  EOF
15
- spec.summary = %q{Middleman extension for bibtex bibliographies}
14
+ spec.summary = %q{Middleman extension for BibTeX bibliographies}
16
15
  spec.homepage = 'https://github.com/jjgreen/middleman-bibtex'
17
16
  spec.license = 'MIT'
18
17
 
@@ -28,4 +27,5 @@ Gem::Specification.new do |spec|
28
27
  spec.add_development_dependency 'bundler'
29
28
  spec.add_development_dependency 'rake'
30
29
  spec.add_development_dependency 'rspec'
30
+ spec.add_development_dependency 'middleman', ['~> 3']
31
31
  end
@@ -0,0 +1,41 @@
1
+ require 'middleman-bibtex'
2
+
3
+ def absolute_path(*parts)
4
+ File.expand_path(File.join(File.dirname(__FILE__), *parts))
5
+ end
6
+
7
+ def fixture(file)
8
+ absolute_path('..', file)
9
+ end
10
+
11
+ activate(:bibtex,
12
+ :path => fixture('test.bib'),
13
+ :style => 'ieee',
14
+ :format => 'html')
15
+
16
+ helpers do
17
+
18
+ # CSS freindly ids
19
+
20
+ def id_tag(key)
21
+ %Q|id="#{key.gsub(/:/,'-')}"|
22
+ end
23
+
24
+ # custom formatting of BibTEX DOI entries
25
+
26
+ def citation_with_links(key)
27
+ entry = citation_entry(key)
28
+ links = []
29
+ if doi = entry['DOI'] then
30
+ links << link_to('DOI', "http://doi.org/#{doi}")
31
+ end
32
+ entry_html = citation_formatted(entry)
33
+ if links.empty? then
34
+ entry_html
35
+ else
36
+ links_html = '(' + links.join(', ') + ')'
37
+ [entry_html, links_html].join(' ')
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Welcome to Middleman-BibTeX
3
+ ---
4
+ <h1>Flexible bibliographies</h1>
5
+
6
+ <ul>
7
+ <% citations_search(nil).each do |key| %>
8
+ <li <%= id_tag(key) %>>
9
+ <%= citation_with_links(key) %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title><%= current_page.data.title %></title>
6
+ </head>
7
+ <body>
8
+ <%= yield %>
9
+ </body>
10
+ </html>
@@ -14,7 +14,8 @@
14
14
  journal = {Proc. London Math. Soc. (2)},
15
15
  volume = 42,
16
16
  pages = {230--265},
17
- year = 1936
17
+ year = 1936,
18
+ doi = {10.1112/plms/s2-42.1.230}
18
19
  }
19
20
 
20
21
  @TechReport{turing:1946,
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'An example bibliography', :type => :feature do
4
+ before do
5
+ visit '/'
6
+ end
7
+
8
+ it 'has the correct title header' do
9
+ expect(page).to have_selector 'h1'
10
+ within 'h1' do
11
+ expect(page).to have_content /Flexible bibliographies/i
12
+ end
13
+ end
14
+
15
+ it 'has an unnumbered list' do
16
+ expect(page).to have_selector 'ul'
17
+ end
18
+
19
+ context 'the list' do
20
+ let(:items) { page.all('li') }
21
+
22
+ it 'has the expected number of items' do
23
+ expect(items.count).to eq 3
24
+ end
25
+
26
+ it 'has the expected ids' do
27
+ expect(items.map { |item| item[:id] })
28
+ .to match_array ['godel-1933', 'turing-1936', 'turing-1946']
29
+ end
30
+ end
31
+
32
+ describe 'an item with a customised DOI link' do
33
+ let(:item) { page.find('li#turing-1936') }
34
+
35
+ it 'should be found' do
36
+ expect(item).to_not be_nil
37
+ end
38
+
39
+ it 'should contain the expected DOI link' do
40
+ expect(item).to have_link('DOI')
41
+ end
42
+ end
43
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,21 @@
1
+ require 'middleman'
2
+ require 'rspec'
3
+ require 'capybara/rspec'
4
+
1
5
  def fixture(subpath)
2
- [File.dirname(__FILE__), 'fixtures', subpath].join('/')
6
+ absolute_path('fixtures', subpath)
7
+ end
8
+
9
+ def example_site
10
+ fixture('site')
11
+ end
12
+
13
+ def absolute_path(*parts)
14
+ File.expand_path(File.join(File.dirname(__FILE__), *parts))
15
+ end
16
+
17
+ ENV['MM_ROOT'] = example_site
18
+ Capybara.app = Middleman::Application.server.inst do
19
+ set :environment, :development
20
+ set :show_exceptions, false
3
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-bibtex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. J. Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-06 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bibtex-ruby
@@ -94,10 +94,23 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: middleman
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3'
97
111
  description: |2
98
- A middleman extension that gives helpers for
99
- creating bibtex citation, a fork from the
100
- middleman-citation extension.
112
+ A middleman extension for BibTeX bibliographies,
113
+ a fork of the middleman-citation extension.
101
114
  email:
102
115
  - j.j.green@gmx.co.uk
103
116
  executables: []
@@ -114,7 +127,11 @@ files:
114
127
  - lib/middleman-bibtex/version.rb
115
128
  - middleman-bibtex.gemspec
116
129
  - spec/bibtex_spec.rb
130
+ - spec/fixtures/site/config.rb
131
+ - spec/fixtures/site/source/index.html.erb
132
+ - spec/fixtures/site/source/layouts/layout.erb
117
133
  - spec/fixtures/test.bib
134
+ - spec/integration_spec.rb
118
135
  - spec/spec_helper.rb
119
136
  homepage: https://github.com/jjgreen/middleman-bibtex
120
137
  licenses:
@@ -139,8 +156,12 @@ rubyforge_project:
139
156
  rubygems_version: 2.2.2
140
157
  signing_key:
141
158
  specification_version: 4
142
- summary: Middleman extension for bibtex bibliographies
159
+ summary: Middleman extension for BibTeX bibliographies
143
160
  test_files:
144
161
  - spec/bibtex_spec.rb
162
+ - spec/fixtures/site/config.rb
163
+ - spec/fixtures/site/source/index.html.erb
164
+ - spec/fixtures/site/source/layouts/layout.erb
145
165
  - spec/fixtures/test.bib
166
+ - spec/integration_spec.rb
146
167
  - spec/spec_helper.rb