Documentation
¶
Index ¶
- func AssembleMarkdown(config AssemblyConfig) (*FrontMatter, []WordCountResult, error)
- func FormatWordCount(result WordCountResult) string
- func LoadBook(fileName string) (*FrontMatter, *Book, error)
- func OutputFiles(outputDir string) ([]string, error)
- func SceneWordCount(path string) (int, error)
- func WriteMarkdownScenes(fd *os.File, sceneFiles []string, sceneHeadings bool) error
- func WriteMetadata(fm *FrontMatter, outdir string) error
- type AssemblyConfig
- type Book
- type BookSpec
- type Chapter
- type FrontMatter
- type IteratedChapter
- type WordCountResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssembleMarkdown ¶
func AssembleMarkdown(config AssemblyConfig) (*FrontMatter, []WordCountResult, error)
AssembleMarkdown assembles a book's scenes into per-chapter markdown files and writes a metadata.yaml for pandoc. Returns the parsed FrontMatter and any word count results (if config.WordCount is true).
func FormatWordCount ¶
func FormatWordCount(result WordCountResult) string
FormatWordCount formats a WordCountResult as a human-readable string.
func OutputFiles ¶
OutputFiles returns a sorted list of the assembled chapter markdown files in the output directory.
func SceneWordCount ¶
SceneWordCount counts the words in a file using pure Go.
func WriteMarkdownScenes ¶
WriteMarkdownScenes writes the contents of scene files to fd, separated by scene break markers. When sceneHeadings is true, each scene is preceded by a ## heading with the scene filename (without extension).
func WriteMetadata ¶
func WriteMetadata(fm *FrontMatter, outdir string) error
Types ¶
type AssemblyConfig ¶
type AssemblyConfig struct {
InputFile string
OutputDir string
WordCount bool
SceneHeadings bool // include scene filenames as ## headings
}
AssemblyConfig holds the parameters for assembling a manuscript.
type Book ¶
func (*Book) GetChapters ¶
func (b *Book) GetChapters() iter.Seq[IteratedChapter]
type FrontMatter ¶
type FrontMatter struct {
Title string `yaml:"title"`
ShortTitle string `yaml:"short_title"`
Author string `yaml:"author"`
AuthorLastName string `yaml:"author_lastname"`
ContactName string `yaml:"contact_name"`
ContactAddress string `yaml:"contact_address"`
ContactCityStateZip string `yaml:"contact_city_state_zip"`
ContactPhone string `yaml:"contact_phone"`
ContactEmail string `yaml:"contact_email"`
}
type IteratedChapter ¶
func (IteratedChapter) HeadingToFilename ¶
func (ic IteratedChapter) HeadingToFilename() string
func (IteratedChapter) Validate ¶
func (ic IteratedChapter) Validate() error
type WordCountResult ¶
WordCountResult holds the word count for a single scene file.