Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow for overriding of bib template

  • Loading branch information...
commit 6a55ebe40dcdb44b91930af7b3fa7ad4ff206feb 1 parent 0178a0a
@inukshuk authored
Showing with 14 additions and 6 deletions.
  1. +14 −6 lib/jekyll/scholar/utilities.rb
View
20 lib/jekyll/scholar/utilities.rb
@@ -36,9 +36,13 @@ def optparse(arguments)
opts.on('-s', '--style STYLE') do |style|
@style = style
end
+
+ opts.on('-T', '--template TEMPLATE') do |template|
+ @bibliography_template = template
+ end
end
- argv = arguments.split(/(\B-[cfqpts]|\B--(?:cited|file|query|prefix|text|style|))/)
+ argv = arguments.split(/(\B-[cfqptTs]|\B--(?:cited|file|query|prefix|text|style|template|))/)
parser.parse argv.map(&:strip).reject(&:empty?)
end
@@ -140,24 +144,28 @@ def reference_tagname
end
def bibliography_template
- return @bibliography_template if @bibliography_template
+ @bibliography_template || config['bibliography_template']
+ end
+
+ def liquid_template
+ return @liquid_template if @liquid_template
- tmp = config['bibliography_template'] || '{{reference}}'
+ tmp = bibliography_template
case
- when tmp.nil?
+ when tmp.nil?, tmp.empty?
tmp = '{{reference}}'
when site.layouts.key?(tmp)
tmp = site.layouts[tmp].content
end
- @bibliography_template = Liquid::Template.parse(tmp)
+ @liquid_template = Liquid::Template.parse(tmp)
end
def bibliography_tag(entry, index)
return missing_reference unless entry
- bibliography_template.render({
+ liquid_template.render({
'entry' => liquidify(entry),
'reference' => reference_tag(entry),
'key' => entry.key,
Please sign in to comment.
Something went wrong with that request. Please try again.