mrdocs::ExtensionRegistry

The user extension scripts declared by a configuration, loaded.

Synopsis

class ExtensionRegistry;

Description

Extensions are optional and live entirely outside the Corpus a corpus is just extracted symbols. An application that has no extensions never needs this type; it does whatever an extension would do in its own code. An application that wants to honor a configuration's extension scripts loads them here and runs them as steps in its own workflow.

A .lua or .js file under an addon root's extensions/ directory is an extension. Running its top level (once, at load) registers two kinds of things: corpus transforms (mrdocs.register_transform) and output generators (mrdocs.register_generator). This object owns the scripting engines and the registered functions, so it must outlive both applyTransforms and any generator it hands out.

Typical workflow, after a corpus is built:

MRDOCS_TRY(ExtensionRegistry ext, ExtensionRegistry::load(config));
MRDOCS_TRY(ext.applyTransforms(corpus, config));
// then run generators: ext.findGenerator(id), else the built-in registry

Member Functions

Name

Description

ExtensionRegistry [constructor]

Move constructor.

~ExtensionRegistry [destructor]

Destructor.

operator=

Move assignment.

applyTransforms

Apply the registered transforms to a corpus.

findGenerator

Return the script‐defined generator with this id, or nullptr.

generators

Return the script‐defined generators, as Generator objects.

Static Member Functions

Name

Description

load

Discover and load the extension scripts declared by a configuration.

Created with MrDocs