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
8e808695
Commit
8e808695
authored
Nov 16, 2014
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add suppress author option
see #65
parent
f8e83b19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
features/citation.feature
features/citation.feature
+28
-0
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+10
-1
No files found.
features/citation.feature
View file @
8e808695
...
...
@@ -29,6 +29,34 @@ Feature: Citations
And
the
"_site/scholar.html"
file should exist
And
I should see
"Flanagan"
in
"_site/scholar.html"
@tags
@cite
@suppress-author
Scenario
:
Citations With Suppressed Author
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
|
bibliography
|
my_references
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/my_references.bib"
:
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
}
"""
And I have a page "scholar.html"
:
"""
---
---
{% cite ruby --suppress_author %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"2008"
in
"_site/scholar.html"
And
I should not see
"Flanagan"
in
"_site/scholar.html"
@tags
@cite
Scenario
:
Missing references
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/utilities.rb
View file @
8e808695
...
...
@@ -38,6 +38,10 @@ module Jekyll
@cited
,
@skip_sort
=
true
,
true
end
opts
.
on
(
'-A'
,
'--suppress_author'
)
do
|
cited
|
@suppress_author
=
true
end
opts
.
on
(
'-f'
,
'--file FILE'
)
do
|
file
|
@bibtex_files
||=
[]
@bibtex_files
<<
file
...
...
@@ -72,7 +76,7 @@ module Jekyll
end
end
argv
=
arguments
.
split
(
/(\B-[cCfqptTslm
]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|max
|))/
)
argv
=
arguments
.
split
(
/(\B-[cCfqptTslm
A]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|max|suppress_author
|))/
)
parser
.
parse
argv
.
map
(
&
:strip
).
reject
(
&
:empty?
)
end
...
...
@@ -142,6 +146,10 @@ module Jekyll
sorted
end
def
suppress_author?
!!
@suppress_author
end
def
repository?
!
config
[
'repository'
].
nil?
&&
!
config
[
'repository'
].
empty?
end
...
...
@@ -338,6 +346,7 @@ module Jekyll
CiteProc
::
CitationItem
.
new
id:
entry
.
id
do
|
c
|
c
.
data
=
CiteProc
::
Item
.
new
entry
.
to_citeproc
c
.
data
[
:'citation-number'
]
=
citation_number
c
.
data
.
suppress!
'author'
if
suppress_author?
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