WorldAnvilImport.h header

#include <ew/app/WorldAnvilImport.h>

Namespace ew::app

Functions

ImportedManuscript ew::app::import::buildWorldAnvilDocuments(const std::vector< std::vector< QString > > &rows, const QString &exportName)

Turns the rows of a World Anvil article export into an importable manuscript rooted at exportName.

Driven by the header row, not by a fixed schema. A World Anvil world defines its own article templates, so two exports from two worlds do not carry the same columns. An importer with a hard-coded field list would work on the world it was written against and quietly drop content from every other one – which is the worst way to fail, because the import appears to succeed.

The title is taken from the first column whose name looks like a title, and the body from the first that looks like content. Every other column is kept, written into the body as a labelled field, because a column this code does not recognise is still worldbuilding somebody wrote and losing it silently is not an option. A row with no usable title is titled after its position, so it is still findable rather than discarded.

Pure and deterministic given rows: the first row is the header, the rest are articles. Documents are returned by pointer (content objects are non-copyable), root first.

ImportedManuscript ew::app::import::importWorldAnvilCsv(const QString &csvPath)

Reads the World Anvil CSV export at csvPath and imports it via buildWorldAnvilDocuments(), naming the root after the file.

Returns an empty result if the file has no data rows or cannot be read.