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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edsl
jekyll-pandoc-multiple-formats
Commits
e03735ad
Unverified
Commit
e03735ad
authored
Feb 17, 2018
by
fauno
Browse files
Options
Downloads
Patches
Plain Diff
pass flags according to site lang
parent
73f7e504
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+9
-1
9 additions, 1 deletion
README.md
lib/jekyll-pandoc-multiple-formats/converter.rb
+7
-2
7 additions, 2 deletions
lib/jekyll-pandoc-multiple-formats/converter.rb
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
+16
-2
16 additions, 2 deletions
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
with
32 additions
and
5 deletions
README.md
+
9
−
1
View file @
e03735ad
...
@@ -50,7 +50,10 @@ pandoc:
...
@@ -50,7 +50,10 @@ pandoc:
latex
:
latex
:
pdf
:
'
--latex-engine=xelatex'
pdf
:
'
--latex-engine=xelatex'
epub
:
'
--epub-chapter-level=2'
epub
:
'
--epub-chapter-level=2'
lang
:
ar
:
all
:
'
-V
mainfont="Amiri"'
pdf
:
'
--include-in-header=_layouts/rtl.tex'
```
```
*
`markdown: pandoc`
will instruct jekyll to use the pandoc html
*
`markdown: pandoc`
will instruct jekyll to use the pandoc html
...
@@ -93,6 +96,11 @@ regular jekyll site build.
...
@@ -93,6 +96,11 @@ regular jekyll site build.
*
`full_file`
generates a single file containing all articles, sectioned
*
`full_file`
generates a single file containing all articles, sectioned
by their main category (the first one defined if many).
by their main category (the first one defined if many).
*
`lang`
is a hash where you can define per-language flags. If you have
a
`lang`
attribute in your site config, this plugin will add the
`-V lang=XX`
flag and any language-specific flag you want. You can
define language flags for
`all`
formats or for specific formats.
**IMPORTANT**
: As of version 0.1.0 the syntax of the config changed.
**IMPORTANT**
: As of version 0.1.0 the syntax of the config changed.
Please upgrade your
`_config.yml`
accordingly.
Please upgrade your
`_config.yml`
accordingly.
...
...
This diff is collapsed.
Click to expand it.
lib/jekyll-pandoc-multiple-formats/converter.rb
+
7
−
2
View file @
e03735ad
...
@@ -45,11 +45,16 @@ module JekyllPandocMultipleFormats
...
@@ -45,11 +45,16 @@ module JekyllPandocMultipleFormats
base
.
class_eval
do
base
.
class_eval
do
# Just return html5
# Just return html5
def
convert
(
content
)
def
convert
(
content
)
flags
=
"
#{
@config
[
'pandoc'
][
'flags'
]
}
#{
@config
[
'pandoc'
][
'site_flags'
]
}
"
lang
=
@config
.
dig
(
'lang'
)
flags
=
[]
flags
<<
@config
.
dig
(
'pandoc'
,
'flags'
)
flags
<<
@config
.
dig
(
'pandoc'
,
'site_flags'
)
flags
<<
@config
.
dig
(
'pandoc'
,
'lang'
,
lang
,
'all'
)
output
=
''
output
=
''
Dir
::
chdir
(
@config
[
'source'
])
do
Dir
::
chdir
(
@config
[
'source'
])
do
Open3
::
popen3
(
"pandoc -t html5
#{
flags
}
"
)
do
|
stdin
,
stdout
,
stderr
,
thread
|
cmd
=
"pandoc -t html5
#{
flags
.
compact
.
join
(
' '
)
}
"
Open3
::
popen3
(
cmd
)
do
|
stdin
,
stdout
,
stderr
,
thread
|
stdin
.
puts
content
stdin
.
puts
content
stdin
.
close
stdin
.
close
...
...
This diff is collapsed.
Click to expand it.
lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
+
16
−
2
View file @
e03735ad
# Copyright (c) 2012-201
5
Nicolás Reynolds <fauno@endefensadelsl.org>
# Copyright (c) 2012-201
8
Nicolás Reynolds <fauno@endefensadelsl.org>
# 2012-2013 Mauricio Pasquier Juan <mpj@endefensadelsl.org>
# 2012-2013 Mauricio Pasquier Juan <mpj@endefensadelsl.org>
# 2013 Brian Candler <b.candler@pobox.com>
# 2013 Brian Candler <b.candler@pobox.com>
#
#
...
@@ -253,13 +253,27 @@ module Jekyll
...
@@ -253,13 +253,27 @@ module Jekyll
@flags
<<
@config
[
'full_flags'
]
@flags
<<
@config
[
'full_flags'
]
end
end
@flags
.
join
' '
if
site_lang?
@flags
<<
"-V lang=
#{
site_lang
}
"
@flags
<<
@config
.
dig
(
'lang'
,
site_lang
,
'all'
)
@flags
<<
@config
.
dig
(
'lang'
,
site_lang
,
@format
)
end
@flags
.
compact
.
join
' '
end
end
def
command
def
command
'pandoc '
<<
flags
'pandoc '
<<
flags
end
end
def
site_lang
@site
.
config
.
dig
(
'lang'
)
end
def
site_lang?
!
site_lang
.
nil?
end
def
full?
def
full?
@extra
[
:full
]
@extra
[
:full
]
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