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
50f6abef
Commit
50f6abef
authored
Apr 12, 2014
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add backwards compatibility to #42
parent
c01810f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
23 deletions
+33
-23
features/support/env.rb
features/support/env.rb
+2
-2
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+31
-21
No files found.
features/support/env.rb
View file @
50f6abef
...
...
@@ -17,10 +17,10 @@ end
TEST_DIR
=
File
.
join
(
'/'
,
'tmp'
,
'jekyll'
)
def
run_jekyll
(
options
=
{})
options
[
'source'
]
||=
TEST_DIR
options
[
'destination'
]
||=
File
.
join
(
TEST_DIR
,
'_site'
)
options
=
Jekyll
.
configuration
(
options
)
site
=
Jekyll
::
Site
.
new
(
options
)
...
...
lib/jekyll/scholar/utilities.rb
View file @
50f6abef
...
...
@@ -2,11 +2,11 @@ module Jekyll
class
Scholar
# Utility methods used by several Scholar plugins. The methods in this
# module may depend on the presence of #config, #bibtex_file, and
# module may depend on the presence of #config, #bibtex_file
s
, and
# #site readers
module
Utilities
attr_reader
:
bibtex_file
,
:
config
,
:site
,
:query
,
attr_reader
:config
,
:site
,
:query
,
:context
,
:prefix
,
:key
,
:text
def
optparse
(
arguments
)
...
...
@@ -18,8 +18,8 @@ module Jekyll
end
opts
.
on
(
'-f'
,
'--file FILE'
)
do
|
file
|
@bibtex_file
||=
[]
@bibtex_file
<<
file
@bibtex_file
s
||=
[]
@bibtex_file
s
<<
file
end
opts
.
on
(
'-q'
,
'--query QUERY'
)
do
|
query
|
...
...
@@ -48,6 +48,15 @@ module Jekyll
parser
.
parse
argv
.
map
(
&
:strip
).
reject
(
&
:empty?
)
end
def
bibtex_files
@bibtex_files
||=
[
config
[
'bibliography'
]]
end
# :nodoc: backwards compatibility
def
bibtex_file
bibtex_files
[
0
]
end
def
bibtex_options
config
[
'bibtex_options'
]
||=
{}
end
...
...
@@ -56,15 +65,23 @@ module Jekyll
config
[
'bibtex_filters'
]
||=
[]
end
def
bibtex_paths
@bibtex_paths
||=
bibtex_files
.
map
{
|
file
|
extend_path
file
}
end
# :nodoc: backwards compatibility
def
bibtex_path
@bibtex_path
||=
extend_path
(
bibtex_file
)
bibtex_paths
[
0
]
end
def
bibliography
unless
@bibliography
tmp
=
""
bibtex_path
.
each
{
|
s
|
tmp
<<
IO
.
read
(
s
)}
@bibliography
=
BibTeX
.
parse
(
tmp
,
bibtex_options
)
@bibliography
=
BibTeX
.
parse
(
bibtex_paths
.
reduce
(
''
)
{
|
s
,
p
|
s
<<
IO
.
read
(
p
)
},
bibtex_options
)
@bibliography
.
replace_strings
if
replace_strings?
end
...
...
@@ -112,22 +129,15 @@ module Jekyll
def
extend_path
(
name
)
if
name
.
nil?
||
name
.
empty?
name
=
[
config
[
'bibliography'
]
]
name
=
config
[
'bibliography'
]
end
ret
=
[]
# return as is if it is an absolute path
return
name
if
name
.
start_with?
(
'/'
)
&&
File
.
exists?
(
name
)
name
.
each
{
|
file
|
# return as is if it is an absolute path
if
file
.
start_with?
(
'/'
)
&&
File
.
exists?
(
file
)
ret
<<
file
else
p
=
File
.
join
(
config
[
'source'
],
file
)
p
<<
'.bib'
unless
File
.
exists?
(
p
)
ret
<<
p
end
}
ret
p
=
File
.
join
(
config
[
'source'
],
name
)
p
<<
'.bib'
unless
File
.
exists?
(
p
)
p
end
def
reference_tag
(
entry
)
...
...
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