WebsiteExport.h header
#include <ew/app/WebsiteExport.h>
Namespace ew::app
WebPage struct
struct ew::app::WebPage
One file of a generated website: its name (relative to the site root, e.g. "index.html") and its complete HTML content.
Members
QString ew::app::WebPage::fileName
The file's name relative to the site root (e.g. "index.html").
QString ew::app::WebPage::title
The page's display title.
QString ew::app::WebPage::html
The page's complete HTML content.
Functions
std::vector< WebPage > ew::app::buildManuscriptSite(const std::vector< ManuscriptSection > §ions, const std::vector< CodexEntry > &codexEntries, const std::vector< WebPage > &mapPages, const QString &siteTitle, const std::function< QString(const QString &)> &renderBody={})
Builds a browsable static website from a compiled manuscript and world bible. sections are in reading order (from compileManuscript); each top-level (level-1) section starts a new chapter page carrying that section and its nested descendants, rendered from Markdown via markdownToHtml. codexEntries (from compileCodex) become the world bible: a "codex.html" index grouping the entities by category with a link to each, plus one page per entity at "<id>.html" – the same target a map region or cross-reference forms from the entity's content id, so those links resolve within the site. The result is: an "index.html" with the site title, a client-side search box over every chapter and entity, and a linked table of contents; one page per chapter with Home/Prev/Next navigation; and, when codexEntries is non-empty, the codex index and entity pages. Every page is self-contained (embedded CSS, no external assets), so the folder can be zipped or served as-is. An empty sections list still yields an index page (and the world bible when codexEntries is non-empty). mapPages are pre-built map pages (assembled by the caller, which alone can read the base-image pixel dimensions the clickable overlay needs – see regionImageMapHtml): they are listed under "Maps" in the index, added to the search index (so region labels are searchable), and returned among the pages. Each map page's file name is its map's "<id>.html", the target a region's sub-map link forms, so drilling between maps resolves. renderBody, when set, renders each chapter section's Markdown body to HTML – pass ew::app::renderEmbeddedBodyHtml (bound to the project and its libraries) to expand ![[...]] block embeds live in the published pages; when unset, bodies render with plain markdownToHtml.
QString ew::app::htmlPageShell(const QString &title, const QString &navHtml, const QString &bodyHtml)
Wraps bodyHtml in a complete, self-contained HTML5 document titled title, with an embedded readable "book" stylesheet (no external assets, so the page works offline and travels in a zip). When navHtml is non-empty it is emitted as a navigation bar above the body. title is HTML-escaped for the <title> and page heading; bodyHtml and navHtml are inserted as-is (they are already HTML produced by the exporter).
std::vector< QString > ew::app::imageSources(const std::vector< WebPage > &pages)
Returns the local image sources referenced by pages – the src of every <img> whose target is a project-relative path – de-duplicated and in first-seen order. External http(s):// URLs, data: URIs, and server-absolute (/-rooted) paths are excluded, since only project-relative files can be copied. The website exporter copies these files alongside the pages so the published site is self-contained.
QString ew::app::slugify(const QString &text, const QString &fallback)
Returns a URL- and filename-safe slug for text: lower-cased, with each run of characters that are not ASCII letters or digits collapsed to a single hyphen and leading/trailing hyphens trimmed (e.g. "Chapter 1: The Fall!" -> "chapter-1-the-fall"). Falls back to fallback when the slug would be empty (a title of only punctuation, say), so a caller always gets a usable name.