Entitymanager for node-js.

Delegates simple templating to SimpleTemplateProcessor and processes other templates by creating a full processing chain.

Non-simple templates are processed in a dedicated node exception domain such that the main input file (the template file) is closed/disposed on all execution paths and we don't leak file descriptors in the presence of either parsing or I/O errors. For simple templates, this isn't necessary as no main input file is opened (the input being supplied via the literal storage manager). For files opened during processing the main file (external parsed or parameter entities, external subsets) this isn't necessary either because these are completely read at once, and are auto-closed by node on error or EOF.

Note that we're re-using the errorhandler from master context to forward error messages to; can't obtain full compatibility with awk impl where we're processing templates in a an awk subprocess.

Implements Entitymanager.

Constructor

new PlatformBaseEntitymanager(sgmldecl, errorhandler, locator, resolver, markupdefinitions, docinfo, outputstream, encoder)

Parameters

Name Type Description
sgmldecl Sgmldecl
errorhandler Errorhandler
locator Locator
resolver SystemSpecificEntityResolver
markupdefinitions Markupdefinitions

used for looking up recorded markup declarations that should be implied for transcluded SGML

docinfo Docinfo
outputstream stream.Writable
encoder Markupencoder

Name Description
configure Configuration method.
prepare_implied_lpd_arguments Prepares CSV-like strings containing link type and document type names for implied LPDs in sub-context.
reset Resets/dealloc constructed nested processing components.
set_completion_callback Registers a callback to invoke when the entitymanager has completed I/O on the most recent data entity.
set_external_subset_identifier Configures the system identifier that a lax template's target document type declaration must reference as external subset identifier.
write_data_entity Catenates a named data entity to outputstream.

Member Details

configure(args)

Configuration method.

Parameters

Name Type Description
args Object.<string, string>

Map of configuration properties.

prepare_implied_lpd_arguments()

Prepares CSV-like strings containing link type and document type names for implied LPDs in sub-context.

Cf. code in awk version.

reset()

Resets/dealloc constructed nested processing components.

set_completion_callback(callback)

Registers a callback to invoke when the entitymanager has completed I/O on the most recent data entity.

Only used for async.

Note callback is a classic-OOP-like interface rather than a plain callback func.

Parameters

Name Type Description
callback Completioncallback
set_external_subset_identifier(identifier)

Configures the system identifier that a lax template's target document type declaration must reference as external subset identifier.

The supplied identifier is resolved against the current locator's identifier, and passed as resolved (either relative to CWD or as absolute identifier)

Parameters

Name Type Description
identifier string
write_data_entity()

Catenates a named data entity to outputstream.

If notation_pubid refers to the SGML public id, or notation_sysid refers to an SGML file/resource, this will invoke recursive SGML processing in a subprocess.

SGML data entities are the only type of entities that are handled.