book

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2025 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package book is the book-specific version of Cogent Author for rendering markdown source into various book documents, including .pdf via latex, .html, .docx and epub.

These files should be located in the current directory where the command is run. Author generates the output files based on Book.Name there, with all of the temporary files used in the generation process in the 'author' directory.

Index

Constants

This section is empty.

Variables

View Source
var PandocInputs embed.FS

Functions

func Book

func Book(c *author.Config) error

Book generates a book based on a set of markdown files, with the following required file names (with [] indicating optional files):

  • metadata.yaml: pandoc metadata with various important options
  • 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
  • [appendix-*.md] appendicies, using a, b, c, etc labeling.
  • [glossary.md] optional glossary that generates links in text.
  • allrefs.bib: source of all references in BibTex format, to use in resolving citations.

Types

type BookData

type BookData struct {
	// Name is the overall name of the book.
	// Output files will be Name.pdf etc.
	Name string

	// names of the chapters, in sorted order.
	Chapters []string

	// names of the appendicies.
	Appendicies []string

	Metadata map[string]any
}

BookData has all of the info about the book.

func NewBookData

func NewBookData(name string) *BookData

func (*BookData) DOCX

func (bk *BookData) DOCX(mdfn string) error

DOCX generates DOCX file from given markdown filename

func (*BookData) EPUB

func (bk *BookData) EPUB(mdfn string) error

EPUB generates EPUB file from given markdown filename

func (*BookData) GetFiles

func (bk *BookData) GetFiles()

func (*BookData) HTML

func (bk *BookData) HTML(mdfn string) error

HTML generates HTML file from given markdown filename

func (*BookData) LaTeX

func (bk *BookData) LaTeX(mdfn string) error

LaTeX generates LaTeX file from given markdown filename

func (*BookData) Markdown

func (bk *BookData) Markdown() string

Markdown generates the combined markdown file that everything else works on.

func (*BookData) PDF

func (bk *BookData) PDF(mdfn string) error

PDF generates PDF file from given markdown filename

func (*BookData) Refs

func (bk *BookData) Refs() error

Refs processes the references

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL