Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jekyll-pandoc-multiple-formats
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edsl
jekyll-pandoc-multiple-formats
Commits
ed9e06e2
Unverified
Commit
ed9e06e2
authored
7 years ago
by
fauno
Browse files
Options
Downloads
Patches
Plain Diff
make assets relative
parent
0b21ceca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
+12
-4
12 additions, 4 deletions
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
with
12 additions
and
4 deletions
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
+
12
−
4
View file @
ed9e06e2
...
...
@@ -36,6 +36,7 @@ module Jekyll
@flags
=
[]
if
posts
.
is_a?
Array
@single_post
=
false
@posts
=
posts
raise
ArgumentError
.
new
"'title' argument is required for multipost file"
unless
title
...
...
@@ -43,6 +44,7 @@ module Jekyll
@title
=
title
@slug
=
Utils
.
slugify
(
@title
)
else
@single_post
=
true
@posts
=
[
posts
]
@title
=
posts
.
data
[
'title'
]
unless
title
@slug
=
posts
.
data
[
'slug'
]
...
...
@@ -74,7 +76,7 @@ module Jekyll
# if it's just one article, the url is the same except it's not html
# otherwise we use the permalink template with some placeholder
def
url
@url
=
if
single_post?
@url
||
=
if
single_post?
single_post
.
url
.
gsub
(
/\.html$/
,
".
#{
@format
}
"
)
else
URL
.
new
({
...
...
@@ -132,8 +134,10 @@ module Jekyll
end
def
content
relative_re
=
/(!\[[^\]]*\]\()\/+/
if
single_post?
single_post
.
content
# make all images relative to source dir
single_post
.
content
.
gsub
(
relative_re
,
'\1'
)
else
header_re
=
/^(#+.*\n*|.*\n[=-]+\n*)\Z/
bib_title
=
""
...
...
@@ -142,7 +146,11 @@ module Jekyll
# remove bibliography titles
# since pandoc does it's own bibliography output, it recommends
# leaving an empty chapter title to mark it as such
post
.
content
.
gsub
(
header_re
,
''
)
content
=
post
.
content
.
gsub
(
header_re
,
''
)
# make all images relative to source dir
content
=
content
.
gsub
(
relative_re
,
'\1'
)
content
# we add the first bibliography title we can find in the end
end
.
join
(
"
\n\n\n
"
)
<<
bib_title
end
...
...
@@ -238,7 +246,7 @@ module Jekyll
end
def
single_post?
@
posts
.
count
==
1
@
single_post
end
def
has_cover?
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment