Skip to content
Snippets Groups Projects
Unverified Commit 1c063103 authored by fauno's avatar fauno
Browse files

generate full file at the end

parent 79b577b4
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment