jekyll-scholar 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -122,6 +122,24 @@ with several reference lists:
122
122
 
123
123
  {% bibliography secondary %}
124
124
 
125
+ Finally, the bibliography tag supports an optional filter parameter. This
126
+ filter takes precedence over the global filter defined in your configuration.
127
+
128
+ {% bibliography filter: @*[year=2013] %}
129
+
130
+ The example above would print a bibliography of all entires published in
131
+ the year 2013. Of course you can also combine the file and filter parameters
132
+ like this:
133
+
134
+ {% bibliography secondary filter: @*[year=2013] %}
135
+
136
+ This would print the publications from 2013 of the bibliography at
137
+ `_bibliography/secondary.bib`.
138
+
139
+ For more details about filters, see the corresponding section below or
140
+ consult the [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby)
141
+ documentation.
142
+
125
143
 
126
144
  ### Citations
127
145
 
@@ -3,12 +3,12 @@ module Jekyll
3
3
 
4
4
  class BibliographyTag < Liquid::Tag
5
5
  include Scholar::Utilities
6
-
6
+
7
7
  def initialize(tag_name, arguments, tokens)
8
8
  super
9
9
 
10
10
  @config = Scholar.defaults.dup
11
- @bibtex_file = arguments.strip
11
+ @bibtex_file, @query = arguments.strip.split(/\s*filter:\s*/)
12
12
  end
13
13
 
14
14
  def render(context)
@@ -17,23 +17,23 @@ module Jekyll
17
17
  references = entries.map do |entry|
18
18
  reference = CiteProc.process entry.to_citeproc, :style => config['style'],
19
19
  :locale => config['locale'], :format => 'html'
20
-
20
+
21
21
  reference = content_tag :span, reference, :id => entry.key
22
-
22
+
23
23
  if generate_details?
24
24
  reference << link_to(details_link_for(entry),
25
25
  config['details_link'], :class => config['details_link_class'])
26
26
  end
27
-
27
+
28
28
  content_tag :li, reference
29
29
  end
30
30
 
31
31
  content_tag :ol, references.join("\n"), :class => config['bibliography_class']
32
- end
32
+ end
33
33
  end
34
-
34
+
35
35
  private
36
-
36
+
37
37
  def citeproc
38
38
  @citeproc ||= CiteProc::Processor.new do |p|
39
39
  p.style = config['style']
@@ -6,7 +6,7 @@ module Jekyll
6
6
  # #site readers
7
7
  module Utilities
8
8
 
9
- attr_reader :bibtex_file, :config, :site
9
+ attr_reader :bibtex_file, :config, :site, :query
10
10
 
11
11
  def bibtex_options
12
12
  @bibtex_options ||= { :filter => :latex }
@@ -21,7 +21,7 @@ module Jekyll
21
21
  end
22
22
 
23
23
  def entries
24
- b = bibliography[config['query']]
24
+ b = bibliography[query || config['query']]
25
25
 
26
26
  unless config['sort_by'] == 'none'
27
27
  b = b.sort_by { |e| e[config['sort_by']].to_s }
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.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.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  version: 1.3.6
259
259
  requirements: []
260
260
  rubyforge_project: jekyll-scholar
261
- rubygems_version: 1.8.24
261
+ rubygems_version: 1.8.25
262
262
  signing_key:
263
263
  specification_version: 3
264
264
  summary: Jekyll extensions for the academic blogger.