jekyll-scholar 5.7.0 → 5.7.1
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 +4 -4
- data/README.md +21 -8
- data/features/bibtex.feature +18 -0
- data/features/details.feature +4 -0
- data/features/filter.feature +51 -0
- data/lib/jekyll/scholar.rb +1 -0
- data/lib/jekyll/scholar/converters/bibtex.rb +2 -1
- data/lib/jekyll/scholar/defaults.rb +1 -1
- data/lib/jekyll/scholar/generators/details.rb +1 -1
- data/lib/jekyll/scholar/plugins/superscript.rb +12 -0
- data/lib/jekyll/scholar/utilities.rb +9 -9
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b87845c10bdf8d4c729fa3e2543aece9221b8cb0
|
4
|
+
data.tar.gz: 8c0098182b2c0a89b2a5957d48040c3d44c94e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3974e0b5e3097b099b6ec97eaa61826e6c8c848adb19711297eae4a25c8a419eda57b80eca928f84513e61ed4868695186d89c989c2968f2c892a27e310fe32
|
7
|
+
data.tar.gz: 7ce8a8fa7a7362c50670a48d7a509ae866c0912e363b76cebb3e852c10ae0428e93bf9601b8d7e282aaff100b701851160f40abf24ba779f0de14a23cf9d1d94
|
data/README.md
CHANGED
@@ -25,18 +25,18 @@ Or add it to your `Gemfile`:
|
|
25
25
|
gem 'jekyll-scholar'
|
26
26
|
|
27
27
|
### Github Pages
|
28
|
-
|
29
|
-
Note that it is not possible to use this plugin with the
|
28
|
+
|
29
|
+
Note that it is not possible to use this plugin with the
|
30
30
|
[default Github pages workflow](https://help.github.com/articles/using-jekyll-with-pages/).
|
31
|
-
Github does not allow any but a few select plugins to run for security reasons,
|
32
|
-
and Jekyll-Scholar is not among them.
|
31
|
+
Github does not allow any but a few select plugins to run for security reasons,
|
32
|
+
and Jekyll-Scholar is not among them.
|
33
33
|
You will have to generate your site locally and push the results to the `master` resp. `gh-pages`
|
34
34
|
branch of your site repository.
|
35
35
|
You can keep sources, configuration and plugins in a separate branch; see e.g.
|
36
36
|
[here](http://davidensinger.com/2013/07/automating-jekyll-deployment-to-github-pages-with-rake/)
|
37
37
|
for details.
|
38
38
|
|
39
|
-
|
39
|
+
|
40
40
|
|
41
41
|
Usage
|
42
42
|
-----
|
@@ -72,8 +72,11 @@ default configuration is as follows:
|
|
72
72
|
|
73
73
|
replace_strings: true
|
74
74
|
join_strings: true
|
75
|
-
|
75
|
+
|
76
76
|
use_raw_bibtex_entry: false
|
77
|
+
bibtex_filters:
|
78
|
+
- superscript
|
79
|
+
- latex
|
77
80
|
|
78
81
|
details_dir: bibliography
|
79
82
|
details_layout: bibtex.html
|
@@ -130,6 +133,12 @@ extended or overridden. For example, the default name for `article` is
|
|
130
133
|
*Journal Articles*, but it can be changed to *Papers* using
|
131
134
|
`type_name: { article => 'Papers' }`.
|
132
135
|
|
136
|
+
The `bibtex_filters` option configures which
|
137
|
+
[BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby) formatting filters
|
138
|
+
values of entries should be passed through. This defaults to the `latex`
|
139
|
+
filter which converts LaTeX character escapes into unicode, and `superscript`
|
140
|
+
which converts the `\textsuperscript` command into a HTML `<sup>` tag.
|
141
|
+
|
133
142
|
### Bibliographies
|
134
143
|
|
135
144
|
Once you have loaded Jekyll-Scholar, all files with the extension `.bib` or
|
@@ -385,9 +394,13 @@ will attempt to read the key `ruby` from file `/home/foo/bar.bib`. It will not
|
|
385
394
|
fallback to the default BibTeX file.
|
386
395
|
|
387
396
|
#### Citation pointing to another page in your site
|
388
|
-
In some cases, you might want your citation to link to another page on your cite (ex. a separate works cited page). As a solution,
|
397
|
+
In some cases, you might want your citation to link to another page on your cite (ex. a separate works cited page). As a solution, add a relative path to your scholar configurations:
|
398
|
+
|
399
|
+
~~~ yaml
|
400
|
+
scholar:
|
401
|
+
relative: "/relative/path/file.html"
|
402
|
+
~~~
|
389
403
|
|
390
|
-
{% cite ruby --relative bibliography.html %}
|
391
404
|
|
392
405
|
#### Multiple bibliographies within one document (like [multibib.sty](http://www.ctan.org/pkg/multibib))
|
393
406
|
|
data/features/bibtex.feature
CHANGED
@@ -63,6 +63,24 @@ Feature: BibTeX
|
|
63
63
|
And the "_site/references.html" file should exist
|
64
64
|
And I should see "Look, an umlaut: ü!" in "_site/references.html"
|
65
65
|
|
66
|
+
@superscript
|
67
|
+
Scenario: Simple Bibliography with LaTeX superscript
|
68
|
+
Given I have a scholar configuration with:
|
69
|
+
| key | value |
|
70
|
+
| style | apa |
|
71
|
+
And I have a page "references.bib":
|
72
|
+
"""
|
73
|
+
---
|
74
|
+
---
|
75
|
+
@misc{umlaut,
|
76
|
+
title = {Look, \textsuperscript{superscript}!},
|
77
|
+
}
|
78
|
+
"""
|
79
|
+
When I run jekyll
|
80
|
+
Then the _site directory should exist
|
81
|
+
And the "_site/references.html" file should exist
|
82
|
+
And I should see "Look, <sup>superscript</sup>!" in "_site/references.html"
|
83
|
+
|
66
84
|
@tags @bibtex
|
67
85
|
Scenario: Embedded BibTeX
|
68
86
|
Given I have a scholar configuration with:
|
data/features/details.feature
CHANGED
@@ -60,6 +60,7 @@ Feature: Details
|
|
60
60
|
<html>
|
61
61
|
<head></head>
|
62
62
|
<body>
|
63
|
+
Page title: {{ page.title }}
|
63
64
|
Title: {{ page.entry.title }}
|
64
65
|
{{ page.entry.bibtex }}
|
65
66
|
</body>
|
@@ -68,6 +69,7 @@ Feature: Details
|
|
68
69
|
When I run jekyll
|
69
70
|
Then the _site directory should exist
|
70
71
|
And the "_site/bibliography/ruby.html" file should exist
|
72
|
+
And I should see "Page title: An Umlaut ä!" in "_site/bibliography/ruby.html"
|
71
73
|
And I should see "Title: An Umlaut ä!" in "_site/bibliography/ruby.html"
|
72
74
|
And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"
|
73
75
|
|
@@ -93,6 +95,7 @@ Feature: Details
|
|
93
95
|
<html>
|
94
96
|
<head></head>
|
95
97
|
<body>
|
98
|
+
Page title: {{ page.title }}
|
96
99
|
Title: {{ page.entry.title }}
|
97
100
|
{{ page.entry.bibtex }}
|
98
101
|
</body>
|
@@ -101,6 +104,7 @@ Feature: Details
|
|
101
104
|
When I run jekyll
|
102
105
|
Then the _site directory should exist
|
103
106
|
And the "_site/bibliography/ruby.html" file should exist
|
107
|
+
And I should see "Page title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
|
104
108
|
And I should see "Title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
|
105
109
|
And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"
|
106
110
|
|
data/features/filter.feature
CHANGED
@@ -228,3 +228,54 @@ Feature: BibTeX
|
|
228
228
|
Then the _site directory should exist
|
229
229
|
And the "_site/scholar.html" file should exist
|
230
230
|
And I should see "\[Pragmatic Bookshelf\]\(https://pragprog.com\)" in "_site/scholar.html"
|
231
|
+
|
232
|
+
@tags @superscript
|
233
|
+
Scenario: LaTeX Superscript as HTML
|
234
|
+
Given I have a scholar configuration with:
|
235
|
+
| key | value |
|
236
|
+
| source | ./_bibliography |
|
237
|
+
And I have the following BibTeX filters:
|
238
|
+
| superscript |
|
239
|
+
And I have a "_bibliography" directory
|
240
|
+
And I have a file "_bibliography/references.bib":
|
241
|
+
"""
|
242
|
+
@misc{pickaxe,
|
243
|
+
title = {This is \textsuperscript{superscript text}.}
|
244
|
+
}
|
245
|
+
"""
|
246
|
+
And I have a page "scholar.html":
|
247
|
+
"""
|
248
|
+
---
|
249
|
+
---
|
250
|
+
{% bibliography %}
|
251
|
+
"""
|
252
|
+
When I run jekyll
|
253
|
+
Then the _site directory should exist
|
254
|
+
And the "_site/scholar.html" file should exist
|
255
|
+
And I should see "This is <sup>superscript text</sup>." in "_site/scholar.html"
|
256
|
+
|
257
|
+
@tags @superscript
|
258
|
+
Scenario: LaTeX Superscript with embedded LaTeX chars as HTML
|
259
|
+
Given I have a scholar configuration with:
|
260
|
+
| key | value |
|
261
|
+
| source | ./_bibliography |
|
262
|
+
And I have the following BibTeX filters:
|
263
|
+
| superscript |
|
264
|
+
| latex |
|
265
|
+
And I have a "_bibliography" directory
|
266
|
+
And I have a file "_bibliography/references.bib":
|
267
|
+
"""
|
268
|
+
@misc{pickaxe,
|
269
|
+
title = {\textsuperscript{\"u \"{u} \v{z}}}
|
270
|
+
}
|
271
|
+
"""
|
272
|
+
And I have a page "scholar.html":
|
273
|
+
"""
|
274
|
+
---
|
275
|
+
---
|
276
|
+
{% bibliography %}
|
277
|
+
"""
|
278
|
+
When I run jekyll
|
279
|
+
Then the _site directory should exist
|
280
|
+
And the "_site/scholar.html" file should exist
|
281
|
+
And I should see "<sup>ü ü ž</sup>" in "_site/scholar.html"
|
data/lib/jekyll/scholar.rb
CHANGED
@@ -30,7 +30,8 @@ module Jekyll
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def convert(content)
|
33
|
-
content = BibTeX.parse(content, :strict => true, :include => [:meta_content],
|
33
|
+
content = BibTeX.parse(content, :strict => true, :include => [:meta_content],
|
34
|
+
:filter => @config['scholar']['bibtex_filters']).map do |b|
|
34
35
|
if b.respond_to?(:to_citeproc)
|
35
36
|
render_bibliography b
|
36
37
|
else
|
@@ -17,7 +17,7 @@ module Jekyll
|
|
17
17
|
'repository' => nil,
|
18
18
|
|
19
19
|
'bibtex_options' => { :strip => false, :parse_months => true },
|
20
|
-
'bibtex_filters' => [ :latex ],
|
20
|
+
'bibtex_filters' => [ :superscript, :latex ],
|
21
21
|
'bibtex_skip_fields' => [ :abstract, :month_numeric ],
|
22
22
|
|
23
23
|
'replace_strings' => true,
|
@@ -15,8 +15,8 @@ module Jekyll
|
|
15
15
|
process(@name)
|
16
16
|
read_yaml(File.join(base, '_layouts'), config['details_layout'])
|
17
17
|
|
18
|
-
data['title'] = entry.title.to_s if entry.field?(:title)
|
19
18
|
data.merge!(reference_data(entry))
|
19
|
+
data['title'] = data['entry']['title'] if data['entry'].has_key?('title')
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class Scholar
|
3
|
+
class Superscript < BibTeX::Filter
|
4
|
+
def apply(value)
|
5
|
+
# Use of \g<1> pattern back-reference to allow for capturing nested {} groups
|
6
|
+
value.to_s.gsub(/\\textsuperscript(\{((?:.|\g<1>)*)\})/) {
|
7
|
+
"<sup>#{$2}</sup>"
|
8
|
+
}
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -18,7 +18,7 @@ module Jekyll
|
|
18
18
|
module Utilities
|
19
19
|
|
20
20
|
|
21
|
-
attr_reader :config, :site, :context, :prefix, :text, :offset, :max
|
21
|
+
attr_reader :config, :site, :context, :prefix, :text, :offset, :max
|
22
22
|
|
23
23
|
|
24
24
|
|
@@ -61,10 +61,6 @@ module Jekyll
|
|
61
61
|
@prefix = prefix
|
62
62
|
end
|
63
63
|
|
64
|
-
opts.on('-r', '--relative RELATIVE') do |relative|
|
65
|
-
@relative = relative.to_s.strip
|
66
|
-
end
|
67
|
-
|
68
64
|
opts.on('-t', '--text TEXT') do |text|
|
69
65
|
@text = text
|
70
66
|
end
|
@@ -102,7 +98,7 @@ module Jekyll
|
|
102
98
|
end
|
103
99
|
end
|
104
100
|
|
105
|
-
argv = arguments.split(/(\B-[
|
101
|
+
argv = arguments.split(/(\B-[cCfqptTsgGOlomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|offset|max|suppress_author|))/)
|
106
102
|
|
107
103
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
108
104
|
end
|
@@ -400,6 +396,10 @@ module Jekyll
|
|
400
396
|
File.join site.source, source
|
401
397
|
end
|
402
398
|
|
399
|
+
def relative
|
400
|
+
config['relative']
|
401
|
+
end
|
402
|
+
|
403
403
|
def reference_tag(entry, index = nil)
|
404
404
|
return missing_reference unless entry
|
405
405
|
|
@@ -560,7 +560,7 @@ module Jekyll
|
|
560
560
|
|
561
561
|
def renderer(force = false)
|
562
562
|
return @renderer if @renderer && !force
|
563
|
-
|
563
|
+
|
564
564
|
@renderer = CiteProc::Ruby::Renderer.new :format => 'html',
|
565
565
|
:style => style, :locale => config['locale']
|
566
566
|
end
|
@@ -598,8 +598,8 @@ module Jekyll
|
|
598
598
|
(context['citation_numbers'] ||= {})[key] ||= cited_keys.length
|
599
599
|
end
|
600
600
|
|
601
|
-
def link_target_for
|
602
|
-
"#{
|
601
|
+
def link_target_for(key)
|
602
|
+
"#{relative}##{[prefix, key].compact.join('-')}"
|
603
603
|
end
|
604
604
|
|
605
605
|
def cite(keys)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-scholar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
4
|
+
version: 5.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/jekyll/scholar/defaults.rb
|
113
113
|
- lib/jekyll/scholar/generators/details.rb
|
114
114
|
- lib/jekyll/scholar/plugins/markdown_links.rb
|
115
|
+
- lib/jekyll/scholar/plugins/superscript.rb
|
115
116
|
- lib/jekyll/scholar/tags/bibliography.rb
|
116
117
|
- lib/jekyll/scholar/tags/bibtex.rb
|
117
118
|
- lib/jekyll/scholar/tags/cite.rb
|