Skip to content

Commit

Permalink
use cover.png instead of cover.jpg for cover image; increase cover im…
Browse files Browse the repository at this point in the history
…age size
  • Loading branch information
kkoreilly committed Aug 23, 2024
1 parent 53ea508 commit 2cf1cd2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion author/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The style of the references is determined by the `csl` property in the `metadata
You must use specific file names to indicate the functionality and ordering of the content within the book, as follows, with [] indicating optional files:

* `metadata.yaml`: pandoc metadata with various important options.
* `cover.jpg`: cover image
* `cover.png`: cover image
* `frontmatter.md`: with copyright, dedication, foreward, preface, prologue sections.
* `chapter-*.md` chapters, using 01 etc numbering to put in order.
* `endmatter.md`: includes epilogue, acknowledgements, author
Expand Down
10 changes: 5 additions & 5 deletions author/book/book.cosh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
// following required file names (with [] indicating optional files):
//
// - metadata.yaml: pandoc metadata with various important options
// - cover.jpg: cover image
// - cover.png: cover image
// - frontmatter.md: with copyright, dedication, foreward, preface, prologue sections.
// - chapter-*.md: chapters, using 01 etc numbering to put in order.
// - endmatter.md: includes epilogue, acknowledgements, author
Expand Down Expand Up @@ -116,16 +116,16 @@ func (bk *BookData) HTML(mdfn string) error {
trg := bk.Name + ".html"

cover := bk.pdi("cover_page.html")
img, _, err := imagex.Open("cover.jpg")
img, _, err := imagex.Open("cover.png")
if err != nil {
return errors.Log(err)
}
imgb64, _ := imagex.ToBase64JPG(img)
imgb64, _ := imagex.ToBase64PNG(img)
f, err := os.Create(cover)
if errors.Log(err); err != nil {
return err
}
f.Write([]byte("<div id=\"cover-image\">\n<img src=\"data:image/jpg;base64,"))
f.Write([]byte("<div id=\"cover-image\">\n<img src=\"data:image/png;base64,"))
f.Write(imgb64)
f.Write([]byte("\"/>\n</div>\n"))
f.Close()
Expand Down Expand Up @@ -171,7 +171,7 @@ func (bk *BookData) EPUB(mdfn string) error {
fmt.Fprintf(f, "<dc:identifier id=\"BookId\" opf:scheme=%q>%s</dc:identifier>\n", md["identifier_scheme"], md["identifier"])
f.Close()

pandoc -f {mdopts} --lua-filter {bk.pdi("glossary-filter.lua")} -F pandoc-crossref --citeproc --bibliography references.bib -t epub --standalone --embed-resources --number-sections --css {bk.pdi("epub.css")} --epub-metadata {emd} --epub-cover-image "cover.jpg" -o {trg} {mdfn}
pandoc -f {mdopts} --lua-filter {bk.pdi("glossary-filter.lua")} -F pandoc-crossref --citeproc --bibliography references.bib -t epub --standalone --embed-resources --number-sections --css {bk.pdi("epub.css")} --epub-metadata {emd} --epub-cover-image "cover.png" -o {trg} {mdfn}
return nil
}

Expand Down
11 changes: 5 additions & 6 deletions author/book/book.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion author/book/pandoc-inputs/cover-page.latex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\begin{center}
\includegraphics[width=5in]{cover.jpg}
\includegraphics[width=8.5in]{cover.png}
\end{center}

2 changes: 1 addition & 1 deletion author/book/typegen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2cf1cd2

Please sign in to comment.