Extends
Methods
addListenersOn(tokenEmitter)
Register to a token source, normally the tokenizer. The event emitter emits a 'chunk' event with a chunk of tokens, and signals the end of tokens by triggering the 'end' event. XXX: Perform registration directly in the constructor?
Parameters:
Name | Type | Description |
---|---|---|
tokenEmitter |
EventEmitter | Token event emitter. |
addTransform(transformation, debugName, rank, type, name)
Add a transform registration.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
transformation |
function |
Properties
|
|||||||||||||||||||||||||||||||||
debugName |
string | Debug string to identify the transformer in a trace. |
|||||||||||||||||||||||||||||||||
rank |
number | A number in [0,3) with:
|
|||||||||||||||||||||||||||||||||
type |
string | One of 'tag', 'text', 'newline', 'comment', 'end', 'martian' (unknown token), 'any' (any token, matched before other matches). |
|||||||||||||||||||||||||||||||||
name |
string | Tag name for tags, omitted for non-tags |
process()
Simple wrapper that processes all tokens passed in.
- Source:
reset()
Reset state between uses.
- Source:
setFrame(parentFrame, title, args, srcText)
Reset the internal token and outstanding-callback state of the TokenTransformManager, but keep registrations untouched.
setPipelineId()
Debugging aid: set pipeline id
.Debugging aid: set pipeline id
- Source:
transformTokens(tokens, parentCB) → {Object|Array|TokenAccumulator|null
}
Run asynchronous transformations. This is the big workhorse where templates, images, links and other async expansions (see the transform recipe parser.js) are processed.
The returned chunk is fully expanded for this phase, and the rank set to reflect this.
Parameters:
Name | Type | Description |
---|---|---|
tokens |
Array | Chunk of tokens, potentially with rank and other meta information associated with it. |
parentCB |
function | Callback for asynchronous results. |
- Source:
Returns:
-
- Type
- Object
-
return.tokens
- Type
- Array
-
return.asyncAccum The tail TokenAccumulator, or else
null
.- Type
-
TokenAccumulator
|
null