fabricatio_novel.rust

Classes

NovelBuilder

A Python-exposed builder for creating EPUB novels.

Functions

split_paragraphs(→ list[str])

Split source text into a list of non-empty paragraph strings.

join_paragraphs(→ str)

Wrap each paragraph in <p> tags and join with newlines.

text_to_xhtml_paragraphs(→ str)

Convenience: split source into paragraphs then wrap in <p> tags.

Package Contents

class fabricatio_novel.rust.NovelBuilder

A Python-exposed builder for creating EPUB novels.

new_novel() NovelBuilder

Initializes a new EPUB novel builder.

set_title(title: str) NovelBuilder
set_description(description: str) NovelBuilder

Sets the novel description.

add_author(author: str) NovelBuilder

Adds an author to the novel metadata.

add_chapter(title: str, content: str) NovelBuilder

Adds a chapter with given title and content.

add_cover_image(path: str | os.PathLike | pathlib.Path, source: str | os.PathLike | pathlib.Path) NovelBuilder

Adds a cover image from the given file path.

add_metadata(key: str, value: str) NovelBuilder

Adds custom metadata key-value pair to the novel.

add_css(css: str) NovelBuilder

Adds CSS styles to the novel.

add_resource(path: str | os.PathLike | pathlib.Path, source: str | os.PathLike | pathlib.Path) NovelBuilder

Adds a resource file to the novel.

add_font(font_family: str, source: str | os.PathLike | pathlib.Path) NovelBuilder

Adds a font file to the novel.

add_inline_toc() NovelBuilder

Enables inline table of contents generation.

export(path: str | os.PathLike | pathlib.Path) NovelBuilder

Exports the built novel to the specified file path.

fabricatio_novel.rust.split_paragraphs(source: str) list[str]

Split source text into a list of non-empty paragraph strings.

fabricatio_novel.rust.join_paragraphs(paras: list[str]) str

Wrap each paragraph in <p> tags and join with newlines.

fabricatio_novel.rust.text_to_xhtml_paragraphs(source: str) str

Convenience: split source into paragraphs then wrap in <p> tags.