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
9241bf90
Commit
9241bf90
authored
11 years ago
by
fauno
Browse files
Options
Downloads
Plain Diff
Merge pull request
#5
from mauriciopasquier/configure-output-path
Configure output path
parents
4f174406
1c0575f0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
pandoc.rb
+11
-6
11 additions, 6 deletions
pandoc.rb
with
12 additions
and
6 deletions
README.md
+
1
−
0
View file @
9241bf90
...
...
@@ -26,6 +26,7 @@ Add to `_config.yml`:
pandoc:
skip: false
output: ./tmp
flags: '--smart --bibliography=ref.bib'
site_flags: '--toc'
outputs:
...
...
This diff is collapsed.
Click to expand it.
pandoc.rb
+
11
−
6
View file @
9241bf90
...
...
@@ -12,20 +12,25 @@ class PandocGenerator < Generator
# Skip conversion if we're skipping, but still cleanup the outputs hash
next
if
site
.
config
[
'pandoc'
][
'skip'
]
# If there isn't a config entry for pandoc's output throw it with the rest
base_dir
=
site
.
config
[
'pandoc'
][
'output'
]
||
site
.
source
site
.
posts
.
each
do
|
post
|
post_path
=
File
.
join
(
output
,
File
.
dirname
(
post
.
url
))
post_path
=
File
.
join
(
base_dir
,
output
,
File
.
dirname
(
post
.
url
))
puts
"Creating
#{
post_path
}
"
FileUtils
.
mkdir_p
(
post_path
)
filename
=
File
.
join
(
output
,
post
.
url
).
gsub
(
/\.html$/
,
".
#{
output
}
"
)
filename
=
post
.
url
.
gsub
(
/\.html$/
,
".
#{
output
}
"
)
filename_with_path
=
File
.
join
(
post_path
,
filename
)
# Special cases, stdout is disabled for these
if
[
'pdf'
,
'epub'
,
'odt'
,
'docx'
].
include?
(
output
)
output_flag
=
"-o
#{
filename
}
"
output_flag
=
"-o
#{
filename
_with_path
}
"
else
output_flag
=
"-t
#{
output
}
-o
#{
filename
}
"
output_flag
=
"-t
#{
output
}
-o
#{
filename
_with_path
}
"
end
# Add cover if epub
...
...
@@ -51,10 +56,10 @@ class PandocGenerator < Generator
end
# Skip failed files
next
if
not
File
.
exist?
filename
next
if
not
File
.
exist?
filename
_with_path
# Add them to the static files list
site
.
static_files
<<
StaticFile
.
new
(
site
,
site
.
source
,
''
,
filename
)
site
.
static_files
<<
StaticFile
.
new
(
site
,
base_dir
,
output
,
filename
)
end
end
end
...
...
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