jekyll-scholar 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -91,11 +91,26 @@ also pass in a name to tell Jekyll-Scholar which bibliography it should render.
91
91
 
92
92
  Let's say you have two bibliographies stored in `_bibliography/books.bib` and
93
93
  `_bibliography/papers.bib`; you can include the bibliographies on your site
94
- by respectively calling:
94
+ by respectively calling `{% bibliography books %}` and
95
+ `{% bibliography papers %}`. For example, you could have a file `references.md`
96
+ with several reference lists:
95
97
 
96
- {% bibliography books %}
97
-
98
- {% bibliography papers %}
98
+ ---
99
+ title: My References
100
+ ---
101
+
102
+ {{ page.title }}
103
+ ================
104
+
105
+ The default Bibliography
106
+ ------------------------
107
+
108
+ {% bibliography %}
109
+
110
+ Secondary References
111
+ --------------------
112
+
113
+ {% bibliography secondary %}
99
114
 
100
115
 
101
116
  ### Citations
@@ -103,9 +118,34 @@ by respectively calling:
103
118
  If you want to reference books or papers from your bibliography in your blog
104
119
  posts, Jekyll-Scholar can help you, too. Simply use the `cite` tag with
105
120
  the appropriate key of the item you want to cite and Jekyll-Scholar will
106
- create a formatted citation reference for you. For example:
121
+ create a formatted citation reference for you. For a quick example, take
122
+ following blog post:
107
123
 
108
- "Once upon a midnight dreary..." {{% cite poe %}}
124
+ ---
125
+ layout: default
126
+ title: A Blogging Scholar
127
+ ---
128
+
129
+ {{ page.title }}
130
+ ================
131
+
132
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
133
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
134
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
135
+ Duis 'aute irure dolor in reprehenderit in voluptate' {% cite derrida:purveyor %}
136
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
137
+ cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
138
+ laborum' {% cite rabinowitz %}.
139
+
140
+ Duis 'aute irure dolor in reprehenderit in voluptate' {% cite breton:surrealism %}
141
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
142
+ cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
143
+ laborum' {% cite rainey %}.
144
+
145
+ References
146
+ ----------
147
+
148
+ {% bibliography %}
109
149
 
110
150
 
111
151
  Contributing
@@ -7,7 +7,7 @@ module Jekyll
7
7
 
8
8
  def initialize(tag_name, arguments, tokens)
9
9
  super
10
-
10
+
11
11
  @config = Scholar.defaults.dup
12
12
  @file = arguments.strip
13
13
  end
@@ -15,10 +15,24 @@ module Jekyll
15
15
  def render(context)
16
16
  config.merge!(context.registers[:site].config['scholar'] || {})
17
17
 
18
- entries.map { |e|
19
- CiteProc.process e.to_citeproc, :style => config['style'],
18
+ references = entries.map do |e|
19
+ r = CiteProc.process e.to_citeproc, :style => config['style'],
20
20
  :locale => config['locale'], :format => 'html'
21
- }.join("\n")
21
+
22
+ r = "<span id='#{e.key}'>#{r}</span>"
23
+
24
+ if e.field?(:url)
25
+ r << "<a href='#{e.url}'>URL</a>"
26
+ end
27
+
28
+ if e.field?(:doi)
29
+ r << "<a href='#{e.doi}'>DOI</a>"
30
+ end
31
+
32
+ "<li>#{r}</li>"
33
+ end
34
+
35
+ "<ol>\n#{references.join("\n")}\n</ol>"
22
36
  end
23
37
 
24
38
  private
@@ -31,7 +45,7 @@ module Jekyll
31
45
  b = bibliography['@*']
32
46
 
33
47
  unless config['sort_by'] == 'none'
34
- b.sort_by! { |e| e[config['sort_by']] }
48
+ b.sort_by! { |e| e[config['sort_by']].to_s }
35
49
  b.reverse! if config['order'] =~ /^(desc|reverse)/i
36
50
  end
37
51
 
@@ -15,12 +15,13 @@ module Jekyll
15
15
  def render(context)
16
16
  config.merge!(context.registers[:site].config['scholar'] || {})
17
17
 
18
- puts key
19
18
  e = bibliography[key]
20
- puts e
19
+
21
20
  if e
22
- CiteProc.process e.to_citeproc, :style => config['style'],
21
+ c = CiteProc.process e.to_citeproc, :style => config['style'],
23
22
  :locale => config['locale'], :format => 'html', :mode => :citation
23
+
24
+ "<a href='##{e.key}'>#{c}</a>"
24
25
  else
25
26
  "(missing reference)"
26
27
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '0.0.2'.freeze
3
+ VERSION = '0.0.3'.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.2
4
+ version: 0.0.3
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-04-22 00:00:00.000000000 Z
12
+ date: 2012-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
16
- requirement: &70141486252080 !ruby/object:Gem::Requirement
16
+ requirement: &70204275141840 !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: *70141486252080
24
+ version_requirements: *70204275141840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: citeproc-ruby
27
- requirement: &70141486251300 !ruby/object:Gem::Requirement
27
+ requirement: &70204275141040 !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: *70141486251300
35
+ version_requirements: *70204275141040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bibtex-ruby
38
- requirement: &70141486249780 !ruby/object:Gem::Requirement
38
+ requirement: &70204275139520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70141486249780
46
+ version_requirements: *70204275139520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70141486264360 !ruby/object:Gem::Requirement
49
+ requirement: &70204275153920 !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: *70141486264360
57
+ version_requirements: *70204275153920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &70141486263420 !ruby/object:Gem::Requirement
60
+ requirement: &70204275153160 !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: *70141486263420
68
+ version_requirements: *70204275153160
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: redgreen
71
- requirement: &70141486262680 !ruby/object:Gem::Requirement
71
+ requirement: &70204275152420 !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: *70141486262680
79
+ version_requirements: *70204275152420
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shoulda
82
- requirement: &70141486261140 !ruby/object:Gem::Requirement
82
+ requirement: &70204275150860 !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: *70141486261140
90
+ version_requirements: *70204275150860
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rr
93
- requirement: &70141486260640 !ruby/object:Gem::Requirement
93
+ requirement: &70204275150340 !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: *70141486260640
101
+ version_requirements: *70204275150340
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: cucumber
104
- requirement: &70141486259820 !ruby/object:Gem::Requirement
104
+ requirement: &70204275149380 !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: *70141486259820
112
+ version_requirements: *70204275149380
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: RedCloth
115
- requirement: &70141486258100 !ruby/object:Gem::Requirement
115
+ requirement: &70204275147660 !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: *70141486258100
123
+ version_requirements: *70204275147660
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rdiscount
126
- requirement: &70141486273300 !ruby/object:Gem::Requirement
126
+ requirement: &70204275162880 !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: *70141486273300
134
+ version_requirements: *70204275162880
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: redcarpet
137
- requirement: &70141486271560 !ruby/object:Gem::Requirement
137
+ requirement: &70204275161140 !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: *70141486271560
145
+ version_requirements: *70204275161140
146
146
  description: A set of jekyll extensions for academic blogging.
147
147
  email: http://sylvester.keil.or.at
148
148
  executables: []