From 965b3c8f03795c5ed9d07c2bb9e74338f13fba56 Mon Sep 17 00:00:00 2001 From: Crt Mori Date: Wed, 16 Dec 2020 18:33:57 +0100 Subject: [PATCH 1/2] Add task to build biography There is some possible optimization in building of the biography if it is presented as task. It exposes that Books folder is not actually purely output folder, because `bio.tex` is just a temporary file. --- Rakefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index c0ebe33..4263aa5 100644 --- a/Rakefile +++ b/Rakefile @@ -185,6 +185,12 @@ desc "Rename all .html files in _site to .md instead." end end +#### BIO +task :bio do +desc "Build biography latex temporary file and place it into Books folder" + system "pandoc --latex-engine=xelatex -o Books/bio.tex Source/_includes/bio.md" +end + #### EPUB task :epub, [:book] do |task, args| @@ -259,8 +265,7 @@ desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke Rake::Task[:rename].invoke - -system "pandoc --latex-engine=xelatex -o Books/bio.tex Source/_includes/bio.md" +Rake::Task[:bio].invoke if "#{args.book}" == "all" filelist = Rake::FileList["_site/*/*-pdf*"] @@ -283,7 +288,6 @@ desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke Rake::Task[:rename].invoke -system "pandoc --latex-engine=xelatex -o Books/bio.tex Source/_includes/bio.md" if "#{args.book}" == "all" filelist = Rake::FileList["_site/*/*-pdf*"] @@ -305,8 +309,7 @@ desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke Rake::Task[:rename].invoke - -system "pandoc --latex-engine=xelatex -o Books/bio.tex Source/_includes/bio.md" +Rake::Task[:bio].invoke if "#{args.book}" == "all" filelist = Rake::FileList["_site/*/*-pdf*"] From de0976cddbead8d8302dd103b1176a8e38480021 Mon Sep 17 00:00:00 2001 From: Crt Mori Date: Wed, 16 Dec 2020 18:39:50 +0100 Subject: [PATCH 2/2] Task rename is always called after jekyll task Just call it in jekyll task instead and save a lot of complications when you try to figure out why you cant see proper output from jekyll task (you see html while you expect markdown based on the comments of using jekyll to compile one long markdown). --- Rakefile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index 4263aa5..4f3fe5c 100644 --- a/Rakefile +++ b/Rakefile @@ -175,6 +175,7 @@ end task :jekyll do desc "Jekyll is muxing our markdown." system "bundle exec jekyll build" + Rake::Task[:rename].invoke end #### RENAME @@ -195,7 +196,6 @@ end task :epub, [:book] do |task, args| Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke desc "Create epub versions of our book(s)." if "#{args.book}" == "all" @@ -216,7 +216,6 @@ end task :smashwords, [:book] do |task, args| Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke desc "Create Smashwords epub versions of our book(s)." if "#{args.book}" == "all" @@ -237,7 +236,6 @@ end task :amazon, [:book] do |task, args| Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke desc "Create Amazon mobi versions of our book(s)." if "#{args.book}" == "all" @@ -264,7 +262,6 @@ task :print, [:book] do |task, args| desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke Rake::Task[:bio].invoke if "#{args.book}" == "all" @@ -286,7 +283,6 @@ task :print, [:book] do |task, args| desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke if "#{args.book}" == "all" @@ -308,7 +304,6 @@ task :pdf, [:book] do |task, args| desc "Create Smashwords epub versions of our book(s)." Rake::Task[:jekyll].invoke -Rake::Task[:rename].invoke Rake::Task[:bio].invoke if "#{args.book}" == "all" @@ -331,7 +326,6 @@ desc "Create all versions of our book(s)." if "#{args.book}" == "all" Rake::Task[:jekyll].invoke - Rake::Task[:rename].invoke Rake::Task[:epub].invoke("all") Rake::Task[:smashwords].invoke("all") Rake::Task[:amazon].invoke("all") @@ -339,7 +333,6 @@ desc "Create all versions of our book(s)." Rake::Task[:pdf].invoke("all") else Rake::Task[:jekyll].invoke - Rake::Task[:rename].invoke Rake::Task[:epub].invoke("#{args.book}") Rake::Task[:smashwords].invoke("#{args.book}") Rake::Task[:amazon].invoke("#{args.book}")