diff --git a/author/README.md b/author/README.md index 27a3d364..0af73f3c 100644 --- a/author/README.md +++ b/author/README.md @@ -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 diff --git a/author/book/book.cosh b/author/book/book.cosh index d2d5555a..9035ffd7 100644 --- a/author/book/book.cosh +++ b/author/book/book.cosh @@ -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 @@ -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("
\n\n\n
\n")) f.Close() @@ -171,7 +171,7 @@ func (bk *BookData) EPUB(mdfn string) error { fmt.Fprintf(f, "%s\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 } diff --git a/author/book/book.go b/author/book/book.go index 28931b0c..61d77f77 100644 --- a/author/book/book.go +++ b/author/book/book.go @@ -42,8 +42,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 @@ -129,16 +128,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("
\n\n\n
\n")) f.Close() @@ -184,7 +183,7 @@ func (bk *BookData) EPUB(mdfn string) error { fmt.Fprintf(f, "%s\n", md["identifier_scheme"], md["identifier"]) f.Close() - shell.Run("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) + shell.Run("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 } diff --git a/author/book/pandoc-inputs/cover-page.latex b/author/book/pandoc-inputs/cover-page.latex index 4f289c33..259517e1 100644 --- a/author/book/pandoc-inputs/cover-page.latex +++ b/author/book/pandoc-inputs/cover-page.latex @@ -1,4 +1,5 @@ +\thispagestyle{empty} \begin{center} -\includegraphics[width=5in]{cover.jpg} +\includegraphics[width=6.5in]{cover.png} \end{center} diff --git a/author/book/pandoc-inputs/latex.template b/author/book/pandoc-inputs/latex.template index eb83715c..9b35fe5a 100644 --- a/author/book/pandoc-inputs/latex.template +++ b/author/book/pandoc-inputs/latex.template @@ -566,7 +566,7 @@ $if(title)$ $if(beamer)$ \frame{\titlepage} $else$ -\maketitle +%% \maketitle $endif$ $if(abstract)$ \begin{abstract} diff --git a/author/book/pandoc-inputs/latex.template.diff b/author/book/pandoc-inputs/latex.template.diff index 047f487b..59f89541 100644 --- a/author/book/pandoc-inputs/latex.template.diff +++ b/author/book/pandoc-inputs/latex.template.diff @@ -1,27 +1,44 @@ -*** latex.template Sat Aug 17 19:13:39 2024 ---- default.latex Sat Aug 17 19:20:57 2024 +*** default.latex Tue Aug 20 12:29:56 2024 +--- latex.template Fri Aug 23 15:08:13 2024 *************** -*** 1,4 **** -- +*** 1,3 **** +--- 1,4 ---- ++ % Options for packages loaded elsewhere \PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} \PassOptionsToPackage{hyphens}{url} ---- 1,3 ---- *************** -*** 452,466 **** +*** 451,456 **** +--- 452,466 ---- \fi $endif$ $endif$ -- \oddsidemargin 0pt -- \evensidemargin 0pt -- \textwidth 6.5in -- \headheight 12pt -- \headsep .5in -- \topmargin -.75in -- \footskip .75in -- \textheight 9in -- \usepackage[font=small]{caption} ++ \oddsidemargin 0pt ++ \evensidemargin 0pt ++ \textwidth 6.5in ++ \headheight 12pt ++ \headsep .5in ++ \topmargin -.75in ++ \footskip .75in ++ \textheight 9in ++ \usepackage[font=small]{caption} $for(header-includes)$ $header-includes$ $endfor$ ---- 451,456 ---- +*************** +*** 556,562 **** + $if(beamer)$ + \frame{\titlepage} + $else$ +! \maketitle + $endif$ + $if(abstract)$ + \begin{abstract} +--- 566,572 ---- + $if(beamer)$ + \frame{\titlepage} + $else$ +! %% \maketitle + $endif$ + $if(abstract)$ + \begin{abstract} diff --git a/author/book/typegen.go b/author/book/typegen.go index 3de9d07e..14453758 100644 --- a/author/book/typegen.go +++ b/author/book/typegen.go @@ -6,4 +6,4 @@ import ( "cogentcore.org/core/types" ) -var _ = types.AddFunc(&types.Func{Name: "cogentcore.org/cogent/author/book.Book", Doc: "Book generates a book based on a set of markdown files, with the\nfollowing required file names (with [] indicating optional files):\n\n - metadata.yaml: pandoc metadata with various important options\n\n- cover.jpg: cover image\n - frontmatter.md: with copyright, dedication, foreward, preface, prologue sections.\n - chapter-*.md: chapters, using 01 etc numbering to put in order.\n - endmatter.md: includes epilogue, acknowledgements, author\n - [appendix-*.md] appendicies, using a, b, c, etc labeling.\n - [glossary.md] optional glossary that generates links in text.\n - allrefs.bib: source of all references in BibTex format, to use in resolving citations.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"c"}, Returns: []string{"error"}}) +var _ = types.AddFunc(&types.Func{Name: "cogentcore.org/cogent/author/book.Book", Doc: "Book generates a book based on a set of markdown files, with the\nfollowing required file names (with [] indicating optional files):\n\n - metadata.yaml: pandoc metadata with various important options\n - cover.png: cover image\n - frontmatter.md: with copyright, dedication, foreward, preface, prologue sections.\n - chapter-*.md: chapters, using 01 etc numbering to put in order.\n - endmatter.md: includes epilogue, acknowledgements, author\n - [appendix-*.md] appendicies, using a, b, c, etc labeling.\n - [glossary.md] optional glossary that generates links in text.\n - allrefs.bib: source of all references in BibTex format, to use in resolving citations.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"c"}, Returns: []string{"error"}})