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
1c063103
Unverified
Commit
1c063103
authored
7 years ago
by
fauno
Browse files
Options
Downloads
Patches
Plain Diff
generate full file at the end
parent
79b577b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/jekyll-pandoc-multiple-formats/generator.rb
+50
-46
50 additions, 46 deletions
lib/jekyll-pandoc-multiple-formats/generator.rb
with
50 additions
and
46 deletions
lib/jekyll-pandoc-multiple-formats/generator.rb
+
50
−
46
View file @
1c063103
...
...
@@ -38,7 +38,9 @@ class PandocGenerator < Generator
@pandoc_files
=
[]
@config
.
outputs
.
each_pair
do
|
output
,
_
|
Jekyll
.
logger
.
info
'Pandoc:'
,
"Generating
#{
output
}
"
@site
.
posts
.
docs
.
each
do
|
post
|
Jekyll
.
logger
.
debug
'Pandoc:'
,
post
.
data
[
'title'
]
Jekyll
::
Hooks
.
trigger
:posts
,
:pre_render
,
post
,
{
format:
output
}
pandoc_file
=
PandocFile
.
new
(
@site
,
output
,
post
)
...
...
@@ -50,24 +52,8 @@ class PandocGenerator < Generator
@pandoc_files
<<
pandoc_file
end
if
@config
.
full_file?
# For parts to make sense, we order articles by date and then by
# category, so each category is ordered by date.
#
# cat1 - art1
# cat1 - art3
# cat2 - art2
full
=
@site
.
posts
.
docs
.
reject
{
|
p
|
p
.
data
.
dig
(
'full'
)
}.
sort_by
do
|
p
|
[
p
.
data
[
'date'
],
p
.
data
[
'categories'
].
first
.
to_s
]
end
full_file
=
PandocFile
.
new
(
@site
,
output
,
full
,
@site
.
config
[
'title'
],
{
full:
true
})
full_file
.
write
@site
.
keep_files
<<
full_file
.
relative_path
@pandoc_files
<<
full_file
end
@site
.
post_attr_hash
(
'categories'
).
each_pair
do
|
title
,
posts
|
Jekyll
.
logger
.
info
'Pandoc:'
,
"Generating category
#{
title
}
"
posts
.
sort!
pandoc_file
=
PandocFile
.
new
(
@site
,
output
,
posts
,
title
)
...
...
@@ -82,11 +68,30 @@ class PandocGenerator < Generator
@site
.
keep_files
<<
pandoc_file
.
relative_path
@pandoc_files
<<
pandoc_file
end
if
@config
.
full_file?
title
=
@site
.
config
.
dig
(
'title'
)
Jekyll
.
logger
.
info
'Pandoc:'
,
"Generating full file
#{
title
}
"
# For parts to make sense, we order articles by date and then by
# category, so each category is ordered by date.
#
# cat1 - art1
# cat1 - art3
# cat2 - art2
full
=
@site
.
posts
.
docs
.
reject
{
|
p
|
p
.
data
.
dig
(
'full'
)
}.
sort_by
do
|
p
|
[
p
.
data
[
'date'
],
p
.
data
[
'categories'
].
first
.
to_s
]
end
full_file
=
PandocFile
.
new
(
@site
,
output
,
full
,
title
,
{
full:
true
})
full_file
.
write
@site
.
keep_files
<<
full_file
.
relative_path
@pandoc_files
<<
full_file
end
end
@pandoc_files
.
each
do
|
pandoc_file
|
# If output is PDF, we also create the imposed PDF
if
pandoc_file
.
pdf?
next
unless
pandoc_file
.
pdf?
if
@config
.
imposition?
...
...
@@ -127,4 +132,3 @@ class PandocGenerator < Generator
end
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