Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
caesr-pub
jekyll-scholar
Commits
a1ad6904
Commit
a1ad6904
authored
Apr 23, 2012
by
Sylvester Keil
Browse files
added links to citations
turned bibiliography into lists
parent
5c67eef8
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
a1ad6904
...
...
@@ -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
...
...
lib/jekyll/scholar/tags/bibliography.rb
View file @
a1ad6904
...
...
@@ -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
...
...
lib/jekyll/scholar/tags/cite.rb
View file @
a1ad6904
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment