Commit a1ad6904 authored by Sylvester Keil's avatar Sylvester Keil

added links to citations

turned bibiliography into lists
parent 5c67eef8
......@@ -91,11 +91,25 @@ also pass in a name to tell Jekyll-Scholar which bibliography it should render.
Let's say you have two bibliographies stored in `_bibliography/books.bib` and
`_bibliography/papers.bib`; you can include the bibliographies on your site
by respectively calling:
by respectively calling `{% bibliography books %}` and
`{% bibliography papers %}`. For example, if you have a file `references.md`:
{% bibliography books %}
{% bibliography papers %}
---
title: My References
---
{{ page.title }}
================
The default Bibliography
------------------------
{% bibliography %}
Secondary References
--------------------
{% bibliography secondary %}
### Citations
......@@ -103,9 +117,34 @@ by respectively calling:
If you want to reference books or papers from your bibliography in your blog
posts, Jekyll-Scholar can help you, too. Simply use the `cite` tag with
the appropriate key of the item you want to cite and Jekyll-Scholar will
create a formatted citation reference for you. For example:
create a formatted citation reference for you. For quick example, take
following blog post:
"Once upon a midnight dreary..." {{% cite poe %}}
---
layout: default
title: A Blogging Scholar
---
{{ page.title }}
================
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis 'aute irure dolor in reprehenderit in voluptate' {% cite derrida:purveyor %}
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
laborum' {% cite rabinowitz %}.
Duis 'aute irure dolor in reprehenderit in voluptate' {% cite breton:surrealism %}
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
laborum' {% cite rainey %}.
References
----------
{% bibliography %}
Contributing
......
......@@ -7,7 +7,7 @@ module Jekyll
def initialize(tag_name, arguments, tokens)
super
@config = Scholar.defaults.dup
@file = arguments.strip
end
......@@ -15,10 +15,24 @@ module Jekyll
def render(context)
config.merge!(context.registers[:site].config['scholar'] || {})
entries.map { |e|
CiteProc.process e.to_citeproc, :style => config['style'],
references = entries.map do |e|
r = CiteProc.process e.to_citeproc, :style => config['style'],
:locale => config['locale'], :format => 'html'
}.join("\n")
r = "<span id='#{e.key}'>#{r}</span>"
if e.field?(:url)
r << "<a href='#{e.url}'>URL</a>"
end
if e.field?(:doi)
r << "<a href='#{e.doi}'>DOI</a>"
end
"<li>#{r}</li>"
end
"<ol>\n#{references.join("\n")}\n</ol>"
end
private
......@@ -31,7 +45,7 @@ module Jekyll
b = bibliography['@*']
unless config['sort_by'] == 'none'
b.sort_by! { |e| e[config['sort_by']] }
b.sort_by! { |e| e[config['sort_by']].to_s }
b.reverse! if config['order'] =~ /^(desc|reverse)/i
end
......
......@@ -15,12 +15,13 @@ module Jekyll
def render(context)
config.merge!(context.registers[:site].config['scholar'] || {})
puts key
e = bibliography[key]
puts e
if e
CiteProc.process e.to_citeproc, :style => config['style'],
c = CiteProc.process e.to_citeproc, :style => config['style'],
:locale => config['locale'], :format => 'html', :mode => :citation
"<a href='##{e.key}'>#{c}</a>"
else
"(missing reference)"
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment