binder

package module
v0.0.0-...-17a5391 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 LoadBook

func LoadBook(fileName string) (*FrontMatter, *Book, error)

func OutputFiles

func OutputFiles(outputDir string) ([]string, error)

OutputFiles returns a sorted list of the assembled chapter markdown files in the output directory.

func SceneWordCount

func SceneWordCount(path string) (int, error)

SceneWordCount counts the words in a file using pure Go.

func WriteMarkdownScenes

func WriteMarkdownScenes(fd *os.File, sceneFiles []string, sceneHeadings bool) error

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

type Book struct {
	BaseDir  string `yaml:"base_dir"`
	Chapters []Chapter
}

func (*Book) GetChapters

func (b *Book) GetChapters() iter.Seq[IteratedChapter]

type BookSpec

type BookSpec struct {
	Book Book `yaml:"book"`
}

type Chapter

type Chapter struct {
	Name      string   `yaml:"name,omitempty"`
	Interlude bool     `yaml:"interlude,omitempty"`
	Subdir    string   `yaml:"subdir,omitempty"`
	Scenes    []string `yaml:"scenes"`
}

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

type IteratedChapter struct {
	Filename string
	Heading  string
	Scenes   []string
}

func (IteratedChapter) HeadingToFilename

func (ic IteratedChapter) HeadingToFilename() string

func (IteratedChapter) Validate

func (ic IteratedChapter) Validate() error

type WordCountResult

type WordCountResult struct {
	Scene string
	Count int
}

WordCountResult holds the word count for a single scene file.

Directories

Path Synopsis
cmd
binder command

Jump to

Keyboard shortcuts

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