diff options
| -rw-r--r-- | lib/willora/willora.rb | 15 | ||||
| -rw-r--r-- | templates/acknowledgments.adoc.erb | 21 | ||||
| -rw-r--r-- | templates/backmatter.adoc.erb | 11 | ||||
| -rw-r--r-- | templates/biography.adoc.erb | 19 | ||||
| -rw-r--r-- | templates/dedication.adoc.erb | 26 | ||||
| -rw-r--r-- | templates/frontmatter-template.adoc.erb | 29 | ||||
| -rw-r--r-- | templates/frontmatter.adoc.erb | 40 |
7 files changed, 119 insertions, 42 deletions
diff --git a/lib/willora/willora.rb b/lib/willora/willora.rb index 1867fbb..9cfe62f 100644 --- a/lib/willora/willora.rb +++ b/lib/willora/willora.rb @@ -95,8 +95,12 @@ class Willora templates = { "Makefile.erb" => "", + "acknowledgments.adoc.erb" => "adoc", + "backmatter.adoc.erb" => "adoc", + "biography.adoc.erb" => "adoc", "CHAP01.adoc.erb" => "adoc", - "frontmatter.adoc.erb" => "adoc", + "dedication.adoc.erb" => "adoc", + "frontmatter-template.adoc.erb" => "adoc", "part01.adoc.erb" => "adoc", } @@ -107,7 +111,14 @@ class Willora end templatefile = File.join(_templatedir, template) result = ERB.new(File.read(templatefile)).result(binding) - newfile = File.join(destdir, File.basename(template, ".erb")) + + # This file gets installed *with* the .erb extension. + if template == "frontmatter-template.adoc.erb" + newfile = File.join(destdir, template) + else + newfile = File.join(destdir, File.basename(template, ".erb")) + end + puts "GENERATE #{newfile}" File.open(newfile, "w") do |fp| fp.puts(result) diff --git a/templates/acknowledgments.adoc.erb b/templates/acknowledgments.adoc.erb new file mode 100644 index 0000000..d7819a1 --- /dev/null +++ b/templates/acknowledgments.adoc.erb @@ -0,0 +1,21 @@ += ACKNOWLEDGMENTS +AUTHOR PLACEHOLDER +:nofooter: +:reproducible: + +// ============================= + +[acknowledgments] += Acknowledgments + +Thank you so much for buying my book! + +XXX Edit this text for yourself. + +// ============================= + +== Part I + +== Chapter 1 + +OK diff --git a/templates/backmatter.adoc.erb b/templates/backmatter.adoc.erb new file mode 100644 index 0000000..afab51a --- /dev/null +++ b/templates/backmatter.adoc.erb @@ -0,0 +1,11 @@ +[acknowledgments%notitle] += Acknowledgments + +image::acknowledgments.pdf[page=3] + +<<< + +[biography%notitle] += About the Author + +image::biography.pdf[page=3] diff --git a/templates/biography.adoc.erb b/templates/biography.adoc.erb new file mode 100644 index 0000000..da516f4 --- /dev/null +++ b/templates/biography.adoc.erb @@ -0,0 +1,19 @@ += BIOGRAPHY +AUTHOR PLACEHOLDER +:nofooter: +:reproducible: + +// ============================= + +[biography] += About the Author + +Here you should edit the tet so that readers can learn all about the author! + +// ============================= + +== Part I + +== Chater 1 + +OK diff --git a/templates/dedication.adoc.erb b/templates/dedication.adoc.erb new file mode 100644 index 0000000..b629561 --- /dev/null +++ b/templates/dedication.adoc.erb @@ -0,0 +1,26 @@ += DEDICATION +AUTHOR PLACEHOLDER +:nofooter: +:reproducible: + +// ============================= + +[colophon%notitle%nonfacing] += Colophon + +PLACEHOLDER + +// ============================= + +[dedication%notitle] += Dedication + +__This book is dedicated to somebody. Edit me please.__ + +// ============================= + +== Part I + +== Chapter 1 + +OK diff --git a/templates/frontmatter-template.adoc.erb b/templates/frontmatter-template.adoc.erb new file mode 100644 index 0000000..f877157 --- /dev/null +++ b/templates/frontmatter-template.adoc.erb @@ -0,0 +1,29 @@ += <%= @opts[:title] %> +<%= @opts[:author] %> +:nofooter: +:reproducible: +:pagenums: + +// =================================================================== + +[colophon%notitle%nonfacing] += Colophon + +<%% if var["VOLUMEKIND"] == "PAPERBACK" %> +image::colophon-paperback.pdf[page=2] +<%% end %> + +<%% if var["VOLUMEKIND"] == "HARDCOVER" %> +image::colophon-hardcover.pdf[page=2] +<%% end %> + +<%% if var["VOLUMEKIND"] == "EPUB" %> +<%%= File.read("colophoncontent-epub.adoc") %> +<%% end %> + +// =================================================================== + +[dedication%notitle] += Dedication + +image::dedication.pdf[page=3] diff --git a/templates/frontmatter.adoc.erb b/templates/frontmatter.adoc.erb deleted file mode 100644 index ef77aea..0000000 --- a/templates/frontmatter.adoc.erb +++ /dev/null @@ -1,40 +0,0 @@ -= <%= @opts[:title] %> -<%= @opts[:author] %> -:nofooter: -:reproducible: -:pagenums: - -<%# =================================================================== %> - -[colophon%notitle%nonfacing] -= Colophon - -(C) <%= Time.now.year.to_s %> <%= @opts[:publisher] %> - -All rights reserved. - -This is a work of fiction. Names, characters, places and incidents are -the product of the author's imagination or are used fictitiously. Any -resemblance to actual events, locales or persons, living or dead, is -purely coincidental. - -Published by <%= @opts[:publisher] %> - -Printed by XXX THE PRINTER. - -Cover design by XXX THE ARTIST. - -Typeset in 12-point EB Garamond. - -First Edition - -// ISBN-13 <%# var["ISBN"] %> - -// Publisher Catalog Number <%# var["CATNO"] %> - -<%# =================================================================== %> - -[dedication%notitle] -= Dedication - -image::dedication.pdf[page=3] |
