Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
J
jekyll-scholar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
caesr-pub
jekyll-scholar
Commits
c83263df
Commit
c83263df
authored
Jan 12, 2016
by
Hendrik van Antwerpen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation and another test case.
parent
ce54dcfe
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
6 deletions
+66
-6
README.md
README.md
+27
-0
features/grouping.feature
features/grouping.feature
+28
-0
lib/jekyll/scholar/defaults.rb
lib/jekyll/scholar/defaults.rb
+2
-0
lib/jekyll/scholar/tags/bibliography.rb
lib/jekyll/scholar/tags/bibliography.rb
+2
-3
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+7
-3
No files found.
README.md
View file @
c83263df
...
@@ -86,6 +86,33 @@ are embedded in the Bibtex fields. This option provides a way to circumvent
...
@@ -86,6 +86,33 @@ are embedded in the Bibtex fields. This option provides a way to circumvent
the problem that the double braces functionality of BibTex is accidentally
the problem that the double braces functionality of BibTex is accidentally
parsed by Liquid, while it was intended to keep the exact capitalization style.
parsed by Liquid, while it was intended to keep the exact capitalization style.
The
`sort_by`
and
`order`
options specify if and how bibliography
entries are sorted. Entries can be sorted on multiple fields, by using
a list of keys, e.g.
`sort_by: year,month`
. Ordering can be specified
per sort level, e.g.
`order: descending,ascending`
will sort the years
descending, but per year the months are ascending. If there are more
sort keys than order directives, the last order entry is used for the
remaining keys.
The
`group_by`
and
`group_order`
options specify how bibliography
items are grouped. Grouping can be multi-level as well,
e.g.
`group_by: type, year`
groups entries per publication type, and
within those groups per year. Ordering for groups is specified in the
same way as the sort order. Publication types -- specified with group
key
`type`
, can be ordered by adding
`type_order`
to the
configuration. For example,
`type_order: article,techreport`
lists
journal articles before technical reports. Types not mentioned in
`type_order`
are considered smaller than types that are
mentioned. Types can be merge in one group using the
`type_aliases`
setting. By default
`phdthesis`
and
`mastersthesis`
are grouped as
`thesis`
. By using, for example,
`type_aliases: { inproceeding =>
article}`
, journal and conference articles appear in a single
group. The display names for entry types are specified with
`type_names`
. Names for common types are provided, but they can be
extended or overridden. For example, the default name for
`article`
is
*Journal Articles*
, but it can be changed to
*Papers*
using
`type_name: { article => 'Papers' }`
.
### Bibliographies
### Bibliographies
Once you have loaded Jekyll-Scholar, all files with the extension
`.bib`
or
Once you have loaded Jekyll-Scholar, all files with the extension
`.bib`
or
...
...
features/grouping.feature
View file @
c83263df
...
@@ -239,6 +239,34 @@ Feature: Grouping BibTeX Bibliographies
...
@@ -239,6 +239,34 @@ Feature: Grouping BibTeX Bibliographies
And
I should not see
"Journal Articles"
in
"_site/scholar.html"
And
I should not see
"Journal Articles"
in
"_site/scholar.html"
And
I should see
"Books"
in
"_site/scholar.html"
And
I should see
"Books"
in
"_site/scholar.html"
@tags
@grouping
Scenario
:
Type Aliases
Given I have a scholar configuration with
:
|
key
|
value
|
|
group_by
|
type
|
|
type_aliases
|
{
phdthesis:
phdthesis
}
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/references.bib"
:
"""
@mastersthesis{ruby1,
title = {MSc Thesis},
}
@phdthesis{ruby2,
title = {PhD Thesis},
}
"""
And I have a page "scholar.html"
:
"""
---
---
{% bibliography -f references %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
Then
I should see
"PhD Theses"
in
"_site/scholar.html"
And
I should not see
"Master's Theses"
in
"_site/scholar.html"
@tags
@grouping
@tags
@grouping
Scenario
:
Month Names
Scenario
:
Month Names
Given I have a scholar configuration with
:
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/defaults.rb
View file @
c83263df
...
@@ -44,6 +44,8 @@ module Jekyll
...
@@ -44,6 +44,8 @@ module Jekyll
'incollection'
=>
'Book Chapters'
,
'incollection'
=>
'Book Chapters'
,
'inproceedings'
=>
'Conference Articles'
,
'inproceedings'
=>
'Conference Articles'
,
'thesis'
=>
'Theses'
,
'thesis'
=>
'Theses'
,
'mastersthesis'
=>
'Master\'s Theses'
,
'phdthesis'
=>
'PhD Theses'
,
'manual'
=>
'Manuals'
,
'manual'
=>
'Manuals'
,
'techreport'
=>
'Technical Reports'
,
'techreport'
=>
'Technical Reports'
,
'misc'
=>
'Miscellaneous'
,
'misc'
=>
'Miscellaneous'
,
...
...
lib/jekyll/scholar/tags/bibliography.rb
View file @
c83263df
...
@@ -61,11 +61,10 @@ module Jekyll
...
@@ -61,11 +61,10 @@ module Jekyll
else
else
groupsOrItems
groupsOrItems
.
map
do
|
keyvalue
,
value
|
.
map
do
|
keyvalue
,
value
|
bibhead
=
content_tag
(
tags
.
first
,
bibhead
=
content_tag
(
tags
.
first
||
group_tags
.
last
,
group_name
(
keys
.
first
,
keyvalue
),
group_name
(
keys
.
first
,
keyvalue
),
:class
=>
config
[
'bibliography_class'
])
:class
=>
config
[
'bibliography_class'
])
bibentries
=
group_renderer
(
value
,
keys
.
drop
(
1
),
bibentries
=
group_renderer
(
value
,
keys
.
drop
(
1
),
tags
.
drop
(
1
))
tags
.
length
>
1
?
tags
.
drop
(
1
)
:
tags
)
bibhead
+
"
\n
"
+
bibentries
bibhead
+
"
\n
"
+
bibentries
end
end
.
join
(
"
\n
"
)
.
join
(
"
\n
"
)
...
...
lib/jekyll/scholar/utilities.rb
View file @
c83263df
...
@@ -202,7 +202,7 @@ module Jekyll
...
@@ -202,7 +202,7 @@ module Jekyll
group_value
(
keys
.
first
,
item
)
group_value
(
keys
.
first
,
item
)
end
end
.
sort
do
|
e1
,
e2
|
.
sort
do
|
e1
,
e2
|
if
order
.
first
=~
/^(desc|reverse)/i
if
(
order
.
first
||
group_order
.
last
)
=~
/^(desc|reverse)/i
group_compare
(
keys
.
first
,
e2
[
0
],
e1
[
0
])
group_compare
(
keys
.
first
,
e2
[
0
],
e1
[
0
])
else
else
group_compare
(
keys
.
first
,
e1
[
0
],
e2
[
0
])
group_compare
(
keys
.
first
,
e1
[
0
],
e2
[
0
])
...
@@ -213,7 +213,7 @@ module Jekyll
...
@@ -213,7 +213,7 @@ module Jekyll
groups
groups
else
else
groups
.
merge
(
groups
)
do
|
key
,
items
|
groups
.
merge
(
groups
)
do
|
key
,
items
|
grouper
(
items
,
keys
.
drop
(
1
),
order
.
length
>
1
?
order
.
drop
(
1
)
:
order
)
grouper
(
items
,
keys
.
drop
(
1
),
order
.
drop
(
1
)
)
end
end
end
end
end
end
...
@@ -259,7 +259,7 @@ module Jekyll
...
@@ -259,7 +259,7 @@ module Jekyll
def
group_value
(
key
,
item
)
def
group_value
(
key
,
item
)
case
key
case
key
when
'type'
when
'type'
config
[
'type_aliases'
]
[
item
.
type
.
to_s
]
||
item
.
type
.
to_s
type_aliases
[
item
.
type
.
to_s
]
||
item
.
type
.
to_s
else
else
value
=
item
[
key
]
value
=
item
[
key
]
if
value
.
numeric?
if
value
.
numeric?
...
@@ -295,6 +295,10 @@ module Jekyll
...
@@ -295,6 +295,10 @@ module Jekyll
@type_order
||=
config
[
'type_order'
]
@type_order
||=
config
[
'type_order'
]
end
end
def
type_aliases
@type_aliases
||=
Scholar
.
defaults
[
'type_aliases'
].
merge
(
config
[
'type_aliases'
])
end
def
type_names
def
type_names
@type_names
||=
Scholar
.
defaults
[
'type_names'
].
merge
(
config
[
'type_names'
])
@type_names
||=
Scholar
.
defaults
[
'type_names'
].
merge
(
config
[
'type_names'
])
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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