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
723f4f75
Commit
723f4f75
authored
May 28, 2014
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add interpolation support to query parameter
parent
2e59679f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
features/bibtex.feature
features/bibtex.feature
+35
-0
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+13
-2
No files found.
features/bibtex.feature
View file @
723f4f75
...
...
@@ -151,6 +151,41 @@ Feature: BibTeX
And
I should not see
"<i>The Ruby Programming Language</i>"
in
"_site/scholar.html"
And
I should see
"<i>Smalltalk Best Practice Patterns</i>"
in
"_site/scholar.html"
@tags
@filter
@variables
@wip
Scenario
:
Filter using interpolated query variable
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/references.bib"
:
"""
@book{ruby,
title = {The Ruby Programming Language},
author = {Flanagan, David and Matsumoto, Yukihiro},
year = {2008},
publisher = {O'Reilly Media}
},
@book{smalltalk,
title = {Smalltalk Best Practice Patterns},
author = {Kent Beck},
year = {1996},
publisher = {Prentice Hall}
}
"""
And I have a page "scholar.html"
:
"""
---
---
{% assign yr = 2000 %}
{% bibliography -f references --query @book[year <= {{ yr }}] %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should not see
"<i>The Ruby Programming Language</i>"
in
"_site/scholar.html"
And
I should see
"<i>Smalltalk Best Practice Patterns</i>"
in
"_site/scholar.html"
@tags
@bibliography
@prefix
Scenario
:
A
Prefixed Bibliography
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/utilities.rb
View file @
723f4f75
...
...
@@ -14,8 +14,7 @@ module Jekyll
# #site readers
module
Utilities
attr_reader
:config
,
:site
,
:query
,
:context
,
:prefix
,
:text
,
:max
attr_reader
:config
,
:site
,
:context
,
:prefix
,
:text
,
:max
def
split_arguments
(
arguments
)
...
...
@@ -123,6 +122,10 @@ module Jekyll
@bibliography
end
def
query
interpolate
@query
end
def
entries
sort
bibliography
[
query
||
config
[
'query'
]]
end
...
...
@@ -387,6 +390,14 @@ module Jekyll
end
end
def
interpolate
(
string
)
return
unless
string
string
.
gsub
(
/{{\s*([\w\.]+)\s*}}/
)
do
|
match
|
context
.
send
(
:resolve
,
$1
)
||
match
end
end
def
set_context_to
(
context
)
@context
,
@site
,
=
context
,
context
.
registers
[
:site
]
config
.
merge!
(
site
.
config
[
'scholar'
]
||
{})
...
...
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