PlainTextImport.h header
#include <ew/app/import/PlainTextImport.h>
Namespace ew::app::import
Enumerations
enum class SourceFormat { PlainText, Markdown }
What the text being imported already is, which decides whether it needs escaping before it is stored as a Markdown body.
Functions
ImportedManuscript ew::app::import::importPlainText(const QString &text, const QString &title, SourceFormat format)
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.
format says what the text already is. Bodies are stored as Markdown, so text that is NOT Markdown must be escaped on the way in or the store reinterprets it – see ew::app::document::plainTextAsMarkdown. There is no default: every caller knows which file it opened, and getting it wrong either mangles prose or defeats a writer's real Markdown.