jekyll-scholar 4.3.6 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 624d5dd714caa864327adada75088b877ed25827
4
- data.tar.gz: cad811afe6ae06efa563182157c5941512a2e671
3
+ metadata.gz: f094338d53949be44b70b8e7f512861a5303130b
4
+ data.tar.gz: 4d4c0bc29496e9600934daacafd2c26c414173cf
5
5
  SHA512:
6
- metadata.gz: 47c45c79bb3695d00ecf15253b5a2e86fa2197d4cef597e640cf60fef0a3d2cbac3b6c6e2f17f80ced496516bdb23e70766dec1c3529a022cd3b0079d58c19e0
7
- data.tar.gz: fee5ceabb41933d6a6363bf96e9e1123307d51d4c22f158c239817c778d8aa9f5ff49138cf3dc5b82eedc4d739ae10fdc915fef96697208d94bdb24699c439c8
6
+ metadata.gz: b72f42658fefc593629b596e1d37ad3409586a41e29add9e25ff0f6b4225073bb0a77fc59672e5675fa3828fced0e9ef2433b29f38517957e8d6739657b9b4da
7
+ data.tar.gz: e9f2a7f85d9b3a99be571f3be8c83ad76c4177246256c2f3cbeb90b59e9fc45476da8a16b06785b7edeeffdc55ce3c291e804aed9b1151adc2db6fbff132f1ce
@@ -38,6 +38,40 @@ Feature: BibTeX
38
38
  And I should see "Programming Ruby" in "_site/scholar.html"
39
39
  And I should not see "The Ruby Programming Language" in "_site/scholar.html"
40
40
 
41
+ @tags @filters
42
+ Scenario: Jekyll Filters
43
+ Given I have a scholar configuration with:
44
+ | key | value |
45
+ | source | ./_bibliography |
46
+ | bibliography_template | template |
47
+ And I have a "_bibliography" directory
48
+ And I have a file "_bibliography/references.bib":
49
+ """
50
+ @book{ruby:2008-Foo,
51
+ title = {The Ruby Programming Language},
52
+ author = {Flanagan, David and Matsumoto, Yukihiro},
53
+ year = {2008},
54
+ publisher = {O'Reilly Media}
55
+ }
56
+ """
57
+ And I have a "_layouts" directory
58
+ And I have a file "_layouts/template.html":
59
+ """
60
+ ---
61
+ ---
62
+ {{ entry.key | slugify }}
63
+ """
64
+ And I have a page "scholar.html":
65
+ """
66
+ ---
67
+ ---
68
+ {% bibliography %}
69
+ """
70
+ When I run jekyll
71
+ Then the _site directory should exist
72
+ And the "_site/scholar.html" file should exist
73
+ And I should see "ruby-2008-foo" in "_site/scholar.html"
74
+
41
75
  @tags @max
42
76
  Scenario: Limit number of entries
43
77
  Given I have a scholar configuration with:
@@ -71,3 +105,62 @@ Feature: BibTeX
71
105
  And the "_site/scholar.html" file should exist
72
106
  And I should not see "Programming Ruby" in "_site/scholar.html"
73
107
  And I should see "The Ruby Programming Language" in "_site/scholar.html"
108
+
109
+ @tags @urls
110
+ Scenario: URLs as text
111
+ Given I have a scholar configuration with:
112
+ | key | value |
113
+ | source | ./_bibliography |
114
+ And I have a "_bibliography" directory
115
+ And I have a file "_bibliography/references.bib":
116
+ """
117
+ @book{pickaxe,
118
+ title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
119
+ author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
120
+ year = {2009},
121
+ edition = 3,
122
+ publisher = {Pragmatic Bookshelf},
123
+ url = {https://pragprog.com}
124
+ }
125
+ """
126
+ And I have a page "scholar.html":
127
+ """
128
+ ---
129
+ ---
130
+ {% bibliography %}
131
+ """
132
+ When I run jekyll
133
+ Then the _site directory should exist
134
+ And the "_site/scholar.html" file should exist
135
+ And I should see "from https://pragprog.com" in "_site/scholar.html"
136
+
137
+ @tags @urls
138
+ Scenario: URLs as Markdown links
139
+ Given I have a scholar configuration with:
140
+ | key | value |
141
+ | source | ./_bibliography |
142
+ And I have the following BibTeX filters:
143
+ | latex |
144
+ | markdown |
145
+ And I have a "_bibliography" directory
146
+ And I have a file "_bibliography/references.bib":
147
+ """
148
+ @book{pickaxe,
149
+ title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
150
+ author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
151
+ year = {2009},
152
+ edition = 3,
153
+ publisher = {Pragmatic Bookshelf},
154
+ url = {https://pragprog.com}
155
+ }
156
+ """
157
+ And I have a page "scholar.html":
158
+ """
159
+ ---
160
+ ---
161
+ {% bibliography %}
162
+ """
163
+ When I run jekyll
164
+ Then the _site directory should exist
165
+ And the "_site/scholar.html" file should exist
166
+ And I should see "from \[https://pragprog.com\]\(https://pragprog.com\)" in "_site/scholar.html"
@@ -43,12 +43,18 @@ Then(/^the (.*) directory should exist$/) do |dir|
43
43
  assert File.directory?(dir)
44
44
  end
45
45
 
46
- Then(/^I should see "(.*)" in "(.*)"$/) do |text, file|
47
- assert_match Regexp.new(text), File.open(file).readlines.join
46
+ Then(/^I should see "(.*)" in "(.*)"$/) do |pattern, file|
47
+ text = File.open(file).readlines.join
48
+
49
+ assert_match Regexp.new(pattern), text,
50
+ "Pattern /#{pattern}/ not found in: #{text}"
48
51
  end
49
52
 
50
- Then(/^I should not see "(.*)" in "(.*)"$/) do |text, file|
51
- assert !File.open(file).readlines.join.match(Regexp.new(text))
53
+ Then(/^I should not see "(.*)" in "(.*)"$/) do |pattern, file|
54
+ text = File.open(file).readlines.join
55
+
56
+ assert !text.match(Regexp.new(pattern)),
57
+ "Did not exptect /#{pattern}/ in: #{text}"
52
58
  end
53
59
 
54
60
 
@@ -27,6 +27,15 @@ Given(/^I have the following BibTeX options:$/) do |table|
27
27
  end
28
28
  end
29
29
 
30
+ Given(/^I have the following BibTeX filters:$/) do |table|
31
+ File.open('_config.yml', 'a') do |f|
32
+ f.write(" bibtex_filters:\n")
33
+ table.raw.flatten.each do |row|
34
+ f.write(" - #{row}\n")
35
+ end
36
+ end
37
+ end
38
+
30
39
  Then(/^"(.*)" should come before "(.*)" in "(.*)"$/) do |p1, p2, file|
31
40
  data = File.open(file).readlines.join('')
32
41
 
@@ -19,3 +19,5 @@ require 'jekyll/scholar/tags/cite_details'
19
19
  require 'jekyll/scholar/tags/quote'
20
20
  require 'jekyll/scholar/tags/reference'
21
21
  require 'jekyll/scholar/generators/details'
22
+
23
+ require 'jekyll/scholar/plugins/markdown_links'
@@ -0,0 +1,14 @@
1
+ # Contriubted by @mfenner
2
+ # See https://github.com/inukshuk/jekyll-scholar/issues/30
3
+
4
+ require 'uri'
5
+
6
+ module Jekyll
7
+ class Scholar
8
+ class Markdown < BibTeX::Filter
9
+ def apply(value)
10
+ value.to_s.gsub(URI.regexp(['http','https','ftp'])) { |c| "[#{$&}](#{$&})" }
11
+ end
12
+ end
13
+ end
14
+ end
@@ -255,6 +255,7 @@ module Jekyll
255
255
 
256
256
  def liquid_template
257
257
  return @liquid_template if @liquid_template
258
+ Liquid::Template.register_filter(Jekyll::Filters)
258
259
 
259
260
  tmp = bibliography_template
260
261
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '4.3.6'.freeze
3
+ VERSION = '4.4.0'.freeze
4
4
  end
5
5
  end
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: 4.3.6
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -110,6 +110,7 @@ files:
110
110
  - lib/jekyll/scholar/converters/bibtex.rb
111
111
  - lib/jekyll/scholar/defaults.rb
112
112
  - lib/jekyll/scholar/generators/details.rb
113
+ - lib/jekyll/scholar/plugins/markdown_links.rb
113
114
  - lib/jekyll/scholar/tags/bibliography.rb
114
115
  - lib/jekyll/scholar/tags/bibtex.rb
115
116
  - lib/jekyll/scholar/tags/cite.rb
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  version: 1.3.6
139
140
  requirements: []
140
141
  rubyforge_project: jekyll-scholar
141
- rubygems_version: 2.4.6
142
+ rubygems_version: 2.4.7
142
143
  signing_key:
143
144
  specification_version: 4
144
145
  summary: Jekyll extensions for the academic blogger.