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
51ec9fcd
Commit
51ec9fcd
authored
Sep 21, 2015
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve link conversion
see #101
parent
23419435
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
features/filter.feature
features/filter.feature
+31
-1
lib/jekyll/scholar/plugins/markdown_links.rb
lib/jekyll/scholar/plugins/markdown_links.rb
+15
-2
No files found.
features/filter.feature
View file @
51ec9fcd
...
...
@@ -140,8 +140,8 @@ Feature: BibTeX
|
key
|
value
|
|
source
|
./_bibliography
|
And I have the following BibTeX filters
:
|
latex
|
|
markdown
|
|
latex
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/references.bib"
:
"""
...
...
@@ -164,3 +164,33 @@ Feature: BibTeX
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And I should see "from \[https
:
//pragprog.com\]\(https
:
//pragprog.com\)"
in
"_site/scholar.html"
@tags
@urls
Scenario
:
LaTeX links as Markdown links
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
And I have the following BibTeX filters
:
|
markdown
|
|
latex
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/references.bib"
:
"""
@book{pickaxe,
title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
year = {2009},
edition = 3,
publisher = {\href\{https://pragprog.com\}\{Pragmatic Bookshelf\}},
}
"""
And I have a page "scholar.html"
:
"""
---
---
{% bibliography %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And I should see "\[Pragmatic Bookshelf\]\(https
:
//pragprog.com\)"
in
"_site/scholar.html"
lib/jekyll/scholar/plugins/markdown_links.rb
View file @
51ec9fcd
# Contri
ub
ted by @mfenner
# Contri
bu
ted by @mfenner
# See https://github.com/inukshuk/jekyll-scholar/issues/30
require
'uri'
URL_PATTERN
=
Regexp
.
compile
([
'\\\\href\\\\{([^\\\\}]+)\\\\}\\\\{([^\\\\}]+)\\\\}'
,
URI
.
regexp
([
'http'
,
'https'
,
'ftp'
])
].
join
(
'|'
))
module
Jekyll
class
Scholar
class
Markdown
<
BibTeX
::
Filter
def
apply
(
value
)
value
.
to_s
.
gsub
(
URI
.
regexp
([
'http'
,
'https'
,
'ftp'
]))
{
|
c
|
"[
#{
$&
}
](
#{
$&
}
)"
}
value
.
to_s
.
gsub
(
URL_PATTERN
)
{
puts
$1
puts
$2
if
$1
"[
#{
$2
}
](
#{
$1
}
)"
else
"[
#{
$&
}
](
#{
$&
}
)"
end
}
end
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