PlainTextImport.h header
#include <ew/app/PlainTextImport.h>
Namespace ew::app
ImportedManuscript struct
struct ew::app::ImportedManuscript
The documents produced by importing plain text: a root document followed by its child scene documents (empty of children when the text is a single scene, in which case the root carries the whole body). The root's parentId is null; each child's parentId is the root's id, and children are ordered by sortIndex. Documents are returned by pointer because content objects are non-copyable.
Members
std::vector<std::unique_ptr<ew::core::Document> > ew::app::ImportedManuscript::documents
The root document followed by its child scene documents (see the struct description).
Functions
ImportedManuscript ew::app::importPlainText(const QString &text, const QString &title)
Parses plain text into a prose manuscript titled title. Line endings are normalised; the text is split into scenes on scene-break lines – a line whose trimmed form is three or more separator characters (any of * - _ = ~ # . · • —), optionally spaced, e.g. "* * *", "---", or "###". Blank scenes are dropped. With two or more scenes, a root Document (of kind Prose, titled title, empty body) is returned with one child Document per scene – each titled from its first non-empty line (trimmed to a sensible length) or "Scene N", parented to the root and ordered by sortIndex. With a single scene, only the root Document is returned, carrying the whole (trimmed) body. Empty or whitespace-only input yields a single empty root document.