Container object representing parsed (general and parameter) entity declarations in an SGML prolog.

Note that stored definitions already embody parameter entities expansions that were effective when markup declarations were parsed; after the prolog has been parsed, parameter entities for an instance are only used in expansion of marked section keyword portions.

Constructor

new Entitydefinitions()

Name Description
entity_replacement_file Maps entity reference names to replacement files (containing markdown text to be processed as replacement contents).
entity_replacement_text Maps entity reference names to replacement text.
general_entity_bracketed_text_type Records the "bracketed text" type of an (internal) general entity determining the tokens to prepend/append to an entity reference.
general_entity_data_attributes Records the attribute specification list (either as-is from markup declarations, or as normalized after first use) for an NDATA entity, if any.
general_entity_data_text_type Records the data text type of an (internal) general entity.
general_entity_declaration_line_number Records the line number of the entity declaration within the declaration set.
general_entity_declaration_set_name Records the declaration set name where an entity is effectively declared.
general_entity_notation Contains the notation name for an NDATA entity.
general_entity_type Records a general entity type (token following a public/system id in general entity declarations).
parameter_entity_bracketed_text_type Records the "bracketed text" type of an (internal) parameter entity determining the tokens to prepend and append to an entity reference.
parameter_entity_data_text_type Records the data text type of an (internal) parameter entity.
parameter_entity_public_identifier Maps parameter entity names to public identifiers.
parameter_entity_replacement_text Maps parameter entity names to replacement text.
parameter_entity_system_identifier Maps parameter entity names to their declared system identifiers if any.
suppress_undeclared_parameter_entity_reference_error Flag to suppress errors due to unresolved parameter entity references.
system_specific_general_entities Records names of system-specific entities (ie.

Name Description
expand_parameter_entity_references Replaces parameter entity references in the argument string by the respective replacement text.
fetch_parameter_entity Does the same as resolve_internal_entity_reference() for parameter entities.
get_entity_replacement_text Returns the replacement text for the argument entity reference if it refers to an internal entity.
is_internal_entity_reference Returns whether the argument string is mapped to an internal entity reference.
put_entity_replacement_text Puts replacement text for the argument entity reference.
reset Resets internal state.

Member Details

entity_replacement_file :Object.<string, string>

Maps entity reference names to replacement files (containing markdown text to be processed as replacement contents).

entity_replacement_text :Object.<string, string>

Maps entity reference names to replacement text.

expand_parameter_entity_references(s): string

Replaces parameter entity references in the argument string by the respective replacement text.

Parameters

Name Type Description
s string

Returns

string

result string with parameter entity references replaced

fetch_parameter_entity(entity_ref): string

Does the same as resolve_internal_entity_reference() for parameter entities.

Parameter entities without options are surrounded by spaces, while those with option are surrounded by whatever token is appropriate

Parameters

Name Type Description
entity_ref string

Returns

string
general_entity_bracketed_text_type :Object.<string, string>

Records the "bracketed text" type of an (internal) general entity determining the tokens to prepend/append to an entity reference.

One of

  • STARTTAG
  • ENDTAG
  • PI
  • MS (marked section)
  • MD (markup declaration)
general_entity_data_attributes :Object.<string, string>

Records the attribute specification list (either as-is from markup declarations, or as normalized after first use) for an NDATA entity, if any.

general_entity_data_text_type :Object.<string, string>

Records the data text type of an (internal) general entity.

Contains one of:

  • SDATA (general entities only)
  • CDATA (general entities only)
  • PI (general or parameter entities; cf. parameter_entity_data_text_type)

The SGML spec says [10.5.3] that

  • PIs that generate data to be inserted in-place should be SDATA entities; a subsequent RE is passed via a characters() event
  • PIs that don't generate data but cause some state change or other functionality should have PI data text type; a RE following a data text entity reference doesn't get passed via events (but is nevertheless by sgmljs.net SGML)

Note that the term "PI" in this context refers to any code sequence interpreted by a target device as a control sequence (such as a printer code), rather than an SGML processing instruction.

See:
Markupdefinitions.parameter_entity_data_text_type
general_entity_declaration_line_number :Object.<string, number>

Records the line number of the entity declaration within the declaration set.

Used to print the proper line number in error messages for data entity declarations (which get validated after prolog has been completely parsed; ie. because entity declaration can forward-reference notations)

general_entity_declaration_set_name :Object.<string, string>

Records the declaration set name where an entity is effectively declared.

general_entity_notation :Object.<string, string>

Contains the notation name for an NDATA entity.

general_entity_type :Object.<string, string>

Records a general entity type (token following a public/system id in general entity declarations).

Is one of the following:

  • SUBDOC
  • NDATA (where the notation name is stored in general_entity_notation)
  • CDATA
  • SDATA
get_entity_replacement_text(entity_ref): string

Returns the replacement text for the argument entity reference if it refers to an internal entity.

Parameters

Name Type Description
entity_ref string

Returns

string
is_internal_entity_reference(entity_ref): number

Returns whether the argument string is mapped to an internal entity reference.

An extra function is needed for this since resolve_internal_entity_reference() may legitimately return an empty string as replacement).

Parameters

Name Type Description
entity_ref string

Returns

number
parameter_entity_bracketed_text_type :Object.<string, string>

Records the "bracketed text" type of an (internal) parameter entity determining the tokens to prepend and append to an entity reference.

One of

  • STARTTAG
  • ENDTAG
  • PI
  • MS (marked section)
  • MD (markup declaration)
parameter_entity_data_text_type :Object.<string, string>

Records the data text type of an (internal) parameter entity.

One of

  • SDATA (general entities only)
  • CDATA (general entitiey only)
  • PI (general or parameter entities)

The SGML spec says [10.5.3] that

  • PIs that generate data to be inserted in-place should be SDATA entities; a subsequent RE is passed via a characters() event
  • PIs that don't generate data but cause some state change or other functionality should have PI data text type; an RE following a data text entity reference doesn't get passed via events() (note, however, sgmljs.net SGML doesn't implement suppression of REs; see FEATURES OTHER KEEPRSRE)

Note that the term "PI" in this context is misleading; what is meant by the SGML std is any code sequence interpreted by a target device as a control sequence (e.g. printer code) not a SGML processing instruction

See:
entitydefinitions.general_entity_data_text_type
parameter_entity_public_identifier :Object.<string, string>

Maps parameter entity names to public identifiers.

Used for eg. markdown SHORTREF maps included in internal subset.

Note that parameter entity references for public identifiers aren't used for expansion in text, but interpreted in a context-dependent hard-coded way.

parameter_entity_replacement_text :Object.<string, string>

Maps parameter entity names to replacement text.

parameter_entity_system_identifier :Object.<string, string>

Maps parameter entity names to their declared system identifiers if any.

put_entity_replacement_text(entity_ref, repl_text)

Puts replacement text for the argument entity reference.

Parameters

Name Type Description
entity_ref string
repl_text string
reset()

Resets internal state.

suppress_undeclared_parameter_entity_reference_error :String

Flag to suppress errors due to unresolved parameter entity references.

Used during parameter entity expansion in the portion containing the keyword in marked section starts during LINKTYPE-PRESCAN.

system_specific_general_entities :Object.<string, string>

Records names of system-specific entities (ie. those declared SYSTEM with omitted system identifier).

These will be requested from the configured resolver.

Doesn't map to anything, just used as set.