jekyll-scholar 0.0.12 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -211,6 +211,18 @@ When Jekyll-Scholar generates detail pages, it also adds links to each
211
211
  entry's detail page to the generated bibliography. You can alter the
212
212
  name of the link via the 'details_link' configuration option.
213
213
 
214
+ Jekyll-Scholar also provides a Liquid tag for conveniently adding links
215
+ to individual detail pages. For example, if you would like to add a simple
216
+ link to one of the items in your bibliography on a page or in a blog post
217
+ you can use the `cite_details` tag to generate the link. For this to work,
218
+ you need to pass the BibTeX key of the element you want to reference to
219
+ the tag and, optionally, provide a text for the link (the default text
220
+ can be set via the 'details_link' configuration option).
221
+
222
+ Duis 'aute irure dolor in reprehenderit in voluptate' velit esse cillum
223
+ dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
224
+ proident {% cite_details key, Click Here For More Details %}.
225
+
214
226
 
215
227
  ### Bibliography Filters
216
228
 
@@ -0,0 +1,57 @@
1
+ Feature: Citations
2
+ As a scholar who likes to blog
3
+ I want to reference cool papers and books from my bibliography
4
+
5
+ @tags @cite_details
6
+ Scenario: A Simple Cite Details Link
7
+ Given I have a scholar configuration with:
8
+ | key | value |
9
+ | source | ./_bibliography |
10
+ | bibliography | my_references |
11
+ And I have a "_bibliography" directory
12
+ And I have a file "_bibliography/my_references.bib":
13
+ """
14
+ @book{ruby,
15
+ title = {The Ruby Programming Language},
16
+ author = {Flanagan, David and Matsumoto, Yukihiro},
17
+ year = {2008},
18
+ publisher = {O'Reilly Media}
19
+ }
20
+ """
21
+ And I have a page "scholar.html":
22
+ """
23
+ ---
24
+ ---
25
+ {% cite_details ruby %}
26
+ """
27
+ When I run jekyll
28
+ Then the _site directory should exist
29
+ And the "_site/scholar.html" file should exist
30
+ And I should see "Details</a>" in "_site/scholar.html"
31
+
32
+ @tags @cite_details
33
+ Scenario: A Simple Cite Details Link With A Text Argument
34
+ Given I have a scholar configuration with:
35
+ | key | value |
36
+ | source | ./_bibliography |
37
+ | bibliography | my_references |
38
+ And I have a "_bibliography" directory
39
+ And I have a file "_bibliography/my_references.bib":
40
+ """
41
+ @book{ruby,
42
+ title = {The Ruby Programming Language},
43
+ author = {Flanagan, David and Matsumoto, Yukihiro},
44
+ year = {2008},
45
+ publisher = {O'Reilly Media}
46
+ }
47
+ """
48
+ And I have a page "scholar.html":
49
+ """
50
+ ---
51
+ ---
52
+ {% cite_details ruby, Click For More %}
53
+ """
54
+ When I run jekyll
55
+ Then the _site directory should exist
56
+ And the "_site/scholar.html" file should exist
57
+ And I should see "Click For More</a>" in "_site/scholar.html"
@@ -11,5 +11,6 @@ require 'jekyll/scholar/utilities'
11
11
  require 'jekyll/scholar/converters/bibtex'
12
12
  require 'jekyll/scholar/tags/bibliography'
13
13
  require 'jekyll/scholar/tags/cite'
14
+ require 'jekyll/scholar/tags/cite_details'
14
15
  require 'jekyll/scholar/tags/quote'
15
16
  require 'jekyll/scholar/generators/details'
@@ -0,0 +1,26 @@
1
+ module Jekyll
2
+ class Scholar
3
+
4
+ class CiteDetailsTag < Liquid::Tag
5
+ include Scholar::Utilities
6
+
7
+ attr_reader :key, :text
8
+
9
+ def initialize(tag_name, arguments, tokens)
10
+ super
11
+
12
+ @config = Scholar.defaults.dup
13
+ @key, @text = arguments.strip.split(/\s*,\s*/, 2)
14
+ end
15
+
16
+ def render(context)
17
+ set_context_to context
18
+ cite_details key, text
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
25
+
26
+ Liquid::Template.register_tag('cite_details', Jekyll::Scholar::CiteDetailsTag)
@@ -79,6 +79,14 @@ module Jekyll
79
79
  rescue
80
80
  "(#{key})"
81
81
  end
82
+
83
+ def cite_details(key, text)
84
+ if bibliography.key?(key)
85
+ link_to details_link_for(bibliography[key]), text || config['details_link']
86
+ else
87
+ "(missing reference)"
88
+ end
89
+ end
82
90
 
83
91
  def content_tag(name, content_or_attributes, attributes = {})
84
92
  if content_or_attributes.is_a?(Hash)
@@ -108,4 +116,4 @@ module Jekyll
108
116
  end
109
117
 
110
118
  end
111
- end
119
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '0.0.12'.freeze
3
+ VERSION = '0.1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-15 00:00:00.000000000 Z
12
+ date: 2012-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
16
- requirement: &70317780805480 !ruby/object:Gem::Requirement
16
+ requirement: &70230385479620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.10'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70317780805480
24
+ version_requirements: *70230385479620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: citeproc-ruby
27
- requirement: &70317780802520 !ruby/object:Gem::Requirement
27
+ requirement: &70230385479100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.0.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70317780802520
35
+ version_requirements: *70230385479100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bibtex-ruby
38
- requirement: &70317780801380 !ruby/object:Gem::Requirement
38
+ requirement: &70230385478620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70317780801380
46
+ version_requirements: *70230385478620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70317780799460 !ruby/object:Gem::Requirement
49
+ requirement: &70230385478160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.9'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70317780799460
57
+ version_requirements: *70230385478160
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &70317780813820 !ruby/object:Gem::Requirement
60
+ requirement: &70230385477680 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.11'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70317780813820
68
+ version_requirements: *70230385477680
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: redgreen
71
- requirement: &70317780812440 !ruby/object:Gem::Requirement
71
+ requirement: &70230385477180 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.2'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70317780812440
79
+ version_requirements: *70230385477180
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shoulda
82
- requirement: &70317780811040 !ruby/object:Gem::Requirement
82
+ requirement: &70230385476700 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.11'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70317780811040
90
+ version_requirements: *70230385476700
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rr
93
- requirement: &70317780809740 !ruby/object:Gem::Requirement
93
+ requirement: &70230385476240 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '1.0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70317780809740
101
+ version_requirements: *70230385476240
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: cucumber
104
- requirement: &70317780807460 !ruby/object:Gem::Requirement
104
+ requirement: &70230385475780 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - =
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '1.1'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70317780807460
112
+ version_requirements: *70230385475780
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: RedCloth
115
- requirement: &70317780821940 !ruby/object:Gem::Requirement
115
+ requirement: &70230385475320 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '4.2'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70317780821940
123
+ version_requirements: *70230385475320
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rdiscount
126
- requirement: &70317780820980 !ruby/object:Gem::Requirement
126
+ requirement: &70230385495740 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '1.6'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70317780820980
134
+ version_requirements: *70230385495740
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: redcarpet
137
- requirement: &70317780819820 !ruby/object:Gem::Requirement
137
+ requirement: &70230385495240 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: '1.9'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70317780819820
145
+ version_requirements: *70230385495240
146
146
  description: ! ' Jekyll-Scholar is for all the academic bloggers out there. It is
147
147
  a set of extensions for Jekyll the awesome, blog aware, static site generator; it
148
148
  formats your BibTeX bibliographies for the web using CSL citation styles and generally
@@ -158,6 +158,7 @@ files:
158
158
  - README.md
159
159
  - features/bibtex.feature
160
160
  - features/citation.feature
161
+ - features/cite_details.feature
161
162
  - features/details.feature
162
163
  - features/filter.feature
163
164
  - features/sorting.feature
@@ -171,6 +172,7 @@ files:
171
172
  - lib/jekyll/scholar/generators/details.rb
172
173
  - lib/jekyll/scholar/tags/bibliography.rb
173
174
  - lib/jekyll/scholar/tags/cite.rb
175
+ - lib/jekyll/scholar/tags/cite_details.rb
174
176
  - lib/jekyll/scholar/tags/quote.rb
175
177
  - lib/jekyll/scholar/utilities.rb
176
178
  - lib/jekyll/scholar/version.rb
@@ -201,6 +203,7 @@ summary: Jekyll extensions for the academic blogger.
201
203
  test_files:
202
204
  - features/bibtex.feature
203
205
  - features/citation.feature
206
+ - features/cite_details.feature
204
207
  - features/details.feature
205
208
  - features/filter.feature
206
209
  - features/sorting.feature