middleman-bibtex 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -23
- data/lib/middleman-bibtex/version.rb +1 -1
- data/middleman-bibtex.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4b5e1fa54ee27f412ca9b43dc3800a1c37dcb6c
|
4
|
+
data.tar.gz: e8a92352f7159a6c57745ce1f546fcf9e6b88a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1fbe4be96c40e143794bd755e0115548653f2c0d85df77eac7c6c5cef9b29c2f76a7fc2d1a61d1c6e2dca2e6fd8163e07ae50fb4c7e5fd8c9cac9c12b67b44
|
7
|
+
data.tar.gz: 4861efc22d8392e9e1901195f23eedf6c5389e9d7d7702fa804e5877f8a65562d4fa79385b9231328967323b6f993a0dc5530590b291e69f96e709843188a63b
|
data/README.md
CHANGED
@@ -1,39 +1,44 @@
|
|
1
1
|
# Middleman-bibtex
|
2
2
|
|
3
3
|
An extension for the [Middleman](http://middlemanapp.com/) static
|
4
|
-
site generator for formating BibTeX bibliographies. This is a fork
|
5
|
-
of the extension
|
4
|
+
site generator for formating BibTeX bibliographies. This is a fork of
|
6
5
|
[middleman-citation](https://github.com/gabysbrain/middleman-citation)
|
7
6
|
which offers similar functionailty.
|
8
7
|
|
9
|
-
An example of a Middleman
|
8
|
+
An example of a Middleman site using this plugin can be found at
|
10
9
|
<http://soliton.vm.bytemark.co.uk/pub/jjg/en/mathematics/papers/>.
|
11
10
|
|
12
11
|
## Installation
|
13
12
|
|
14
|
-
|
13
|
+
If using version 4 or higher Middleman then add
|
15
14
|
|
16
|
-
|
15
|
+
gem 'middleman-bibtex'
|
17
16
|
|
18
|
-
|
17
|
+
to your Gemfile; for Middleman versions 3.* then instead use
|
19
18
|
|
20
|
-
|
19
|
+
gem 'middleman-bibtex', '< 0.3'
|
20
|
+
|
21
|
+
then execute
|
22
|
+
|
23
|
+
bundle install
|
21
24
|
|
22
25
|
Or install it yourself as:
|
23
26
|
|
24
|
-
|
27
|
+
gem install middleman-bibtex
|
25
28
|
|
26
29
|
## Configuration
|
27
30
|
|
28
31
|
In your `config.rb` file for your site add:
|
29
32
|
|
30
|
-
|
33
|
+
```ruby
|
34
|
+
require 'middleman-bibtex'
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
activate :bibtex do |opts|
|
37
|
+
opts.path = '/path/to/your.bib' # path to a bibtex file
|
38
|
+
opts.style = 'ieee' # style from citeproc-styles
|
39
|
+
opts.format = 'html' # output format
|
40
|
+
end
|
41
|
+
```
|
37
42
|
|
38
43
|
## Usage
|
39
44
|
|
@@ -49,6 +54,18 @@ templates.
|
|
49
54
|
`citations_search`, return a formatted string the citation according to
|
50
55
|
how the `style` and `format` options were set.
|
51
56
|
|
57
|
+
Typical template:
|
58
|
+
|
59
|
+
```html+erb
|
60
|
+
<ul>
|
61
|
+
<% citations_search(nil).each do |key| %>
|
62
|
+
<li id="<%= key %>">
|
63
|
+
<%= citation(key) %>
|
64
|
+
</li>
|
65
|
+
<% end %>
|
66
|
+
</ul>
|
67
|
+
```
|
68
|
+
|
52
69
|
For extra control on the output, one can use:
|
53
70
|
|
54
71
|
* `citation_entry(key)`: Return the unformatted entry (a hash)
|
@@ -58,20 +75,25 @@ For extra control on the output, one can use:
|
|
58
75
|
|
59
76
|
In fact the `citation` method is implemented using these:
|
60
77
|
|
61
|
-
|
62
|
-
|
63
|
-
|
78
|
+
```ruby
|
79
|
+
def citation(key)
|
80
|
+
citation_formatted(citation_entry(key))
|
81
|
+
end
|
82
|
+
```
|
64
83
|
|
65
84
|
The point is that one can interrogate the unformatted entry to
|
66
85
|
add extra formatting: The following code adds a DOI link if the
|
67
86
|
entry matching the `key` has a `URL` field containing the DOI.
|
68
87
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
88
|
+
```ruby
|
89
|
+
entry = citation_entry(key)
|
90
|
+
entry_html = citation_formatted(entry)
|
91
|
+
unless (doi_url = entry['URL']).nil? then
|
92
|
+
doi_link = format('(%s)', link_to('doi', doi_url))
|
93
|
+
end
|
94
|
+
[entry_html, doi_link].compact.join(' ')
|
95
|
+
```
|
75
96
|
|
76
97
|
[![Gem Version](https://badge.fury.io/rb/middleman-bibtex.svg)](https://badge.fury.io/rb/middleman-bibtex)
|
77
98
|
[![Build Status](https://travis-ci.org/jjgreen/middleman-bibtex.svg)](https://travis-ci.org/jjgreen/middleman-bibtex)
|
99
|
+
[![Dependency Status](https://dependencyci.com/github/jjgreen/middleman-bibtex/badge)](https://dependencyci.com/github/jjgreen/middleman-bibtex)
|
data/middleman-bibtex.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
a fork of the middleman-citation extension.
|
13
13
|
EOF
|
14
14
|
spec.summary = %q{Middleman extension for BibTeX bibliographies}
|
15
|
-
spec.homepage = 'https://
|
15
|
+
spec.homepage = 'https://gitlab.com/jjg/middleman-bibtex'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'bundler'
|
28
28
|
spec.add_development_dependency 'rake'
|
29
29
|
spec.add_development_dependency 'rspec'
|
30
|
+
spec.add_development_dependency 'capybara'
|
30
31
|
spec.add_development_dependency 'middleman', ['~> 4.0']
|
31
32
|
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.3.
|
4
|
+
version: 0.3.1
|
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:
|
11
|
+
date: 2018-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bibtex-ruby
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: capybara
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: middleman
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +147,7 @@ files:
|
|
133
147
|
- spec/fixtures/test.bib
|
134
148
|
- spec/integration_spec.rb
|
135
149
|
- spec/spec_helper.rb
|
136
|
-
homepage: https://
|
150
|
+
homepage: https://gitlab.com/jjg/middleman-bibtex
|
137
151
|
licenses:
|
138
152
|
- MIT
|
139
153
|
metadata: {}
|
@@ -153,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
167
|
version: '0'
|
154
168
|
requirements: []
|
155
169
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.2.
|
170
|
+
rubygems_version: 2.5.2.1
|
157
171
|
signing_key:
|
158
172
|
specification_version: 4
|
159
173
|
summary: Middleman extension for BibTeX bibliographies
|