Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
caesr-pub
jekyll-scholar
Commits
c7fba8be
Commit
c7fba8be
authored
Jan 07, 2016
by
Sylvester Keil
Browse files
Add --raw_bibtex option
See #117
parent
953d112d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
3 deletions
+37
-3
features/bibtex.feature
features/bibtex.feature
+23
-0
features/cited_only.feature
features/cited_only.feature
+0
-1
features/details.feature
features/details.feature
+1
-1
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+13
-1
No files found.
features/bibtex.feature
View file @
c7fba8be
...
...
@@ -270,3 +270,26 @@ Feature: BibTeX
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"<i>The Ruby Programming Language</i>. O’Reilly Media, 2008"
in
"_site/scholar.html"
@tags
@bibliography
@config
@template
Scenario
:
Raw bibtex template
Given I have a scholar configuration with
:
|
key
|
value
|
|
bibliography_template
|
"{{entry.bibtex}}"
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/references.bib"
:
"""
@book{ruby,
title = {The Ruby Programming Language}
}
"""
And I have a page "scholar.html"
:
"""
---
---
{% bibliography -f references --raw_bibtex %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"{%raw%}@book"
in
"_site/scholar.html"
features/cited_only.feature
View file @
c7fba8be
...
...
@@ -70,7 +70,6 @@ Feature: Cited-only Bibliographies
And
I should not see
"<i>The Ruby Programming Language</i>"
in
"_site/scholar.html"
And
I should not see
"<i>Smalltalk Best Practice Patterns</i>"
in
"_site/scholar.html"
@wip
Scenario
:
Cited items with prefix
Given I have a scholar configuration with
:
|
key
|
value
|
...
...
features/details.feature
View file @
c7fba8be
...
...
@@ -209,7 +209,7 @@ Feature: Details
And
the
"_site/bibliography/august.html"
file should exist
And
I should see
"month = aug"
in
"_site/bibliography/august.html"
@generators
@parse_months
@wip
@generators
@parse_months
Scenario
:
Month parsing can be turned off
Given I have a scholar configuration with
:
|
key
|
value
|
...
...
lib/jekyll/scholar/utilities.rb
View file @
c7fba8be
...
...
@@ -80,9 +80,13 @@ module Jekyll
opts
.
on
(
'-T'
,
'--template TEMPLATE'
)
do
|
template
|
@bibliography_template
=
template
end
opts
.
on
(
'-R'
,
'--raw_bibtex'
)
do
|
raw_bibtex
|
@raw_bibtex
=
raw_bibtex
end
end
argv
=
arguments
.
split
(
/(\B-[cCfqptTslomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|offset|max|suppress_author|))/
)
argv
=
arguments
.
split
(
/(\B-[cCfqptTslomA
R
]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|offset|max|suppress_author|
raw_bibtex|
))/
)
parser
.
parse
argv
.
map
(
&
:strip
).
reject
(
&
:empty?
)
end
...
...
@@ -177,6 +181,10 @@ module Jekyll
!!
@suppress_author
end
def
raw_bibtex?
!!
@raw_bibtex
end
def
repository?
!
config
[
'repository'
].
nil?
&&
!
config
[
'repository'
].
empty?
end
...
...
@@ -329,6 +337,10 @@ module Jekyll
e
[
'bibtex'
]
=
tmp
.
to_s
end
if
raw_bibtex?
e
[
'bibtex'
]
=
"{%raw%}
#{
e
[
'bibtex'
]
}
{%endraw%}"
end
entry
.
fields
.
each
do
|
key
,
value
|
value
=
value
.
convert
(
*
bibtex_filters
)
unless
bibtex_filters
.
empty?
e
[
key
.
to_s
]
=
value
.
to_s
...
...
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