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
85b160dc
Commit
85b160dc
authored
Jan 31, 2016
by
Patrick de Kok
Browse files
Added --group_by option for bibliography tag
parent
cf3ba190
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/jekyll/scholar/utilities.rb
View file @
85b160dc
...
...
@@ -18,7 +18,7 @@ module Jekyll
module
Utilities
attr_reader
:config
,
:site
,
:context
,
:prefix
,
:text
,
:offset
,
:max
,
:relative
attr_reader
:config
,
:site
,
:context
,
:prefix
,
:text
,
:offset
,
:max
,
:relative
,
:group_by
...
...
@@ -85,12 +85,16 @@ module Jekyll
@style
=
style
end
opts
.
on
(
'-g'
,
'--group_by GROUP'
)
do
|
group_by
|
@group_by
=
group_by
end
opts
.
on
(
'-T'
,
'--template TEMPLATE'
)
do
|
template
|
@bibliography_template
=
template
end
end
argv
=
arguments
.
split
(
/(\B-[cCfqrptTslomA]|\B--(?:cited(_in_order)?|file|query|relative|prefix|text|style|template|locator|offset|max|suppress_author|))/
)
argv
=
arguments
.
split
(
/(\B-[cCfqrptTs
g
lomA]|\B--(?:cited(_in_order)?|file|query|relative|prefix|text|style|
group_by|
template|locator|offset|max|suppress_author|))/
)
parser
.
parse
argv
.
map
(
&
:strip
).
reject
(
&
:empty?
)
end
...
...
@@ -199,7 +203,7 @@ module Jekyll
end
def
group?
config
[
'group_by'
]
!=
'none'
(
group_by
.
nil?
&&
config
[
'group_by'
]
!=
'none'
)
||
(
!
group_by
.
nil?
&&
group_by
!=
'none'
)
end
def
group
(
ungrouped
)
...
...
@@ -222,7 +226,7 @@ module Jekyll
def
group_keys
return
@group_keys
unless
@group_keys
.
nil?
@group_keys
=
Array
(
config
[
'group_by'
])
@group_keys
=
Array
(
(
group_by
.
nil?
||
group_by
.
empty?
)
?
config
[
'group_by'
]
:
group_by
)
.
map
{
|
key
|
key
.
to_s
.
split
(
/\s*,\s*/
)
}
.
flatten
.
map
{
|
key
|
key
==
'month'
?
'month_numeric'
:
key
}
...
...
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