ImportStream

How to get ImportStream

ES2015+:

import ImportStream from 'fontoxml-pipelined-importer/ImportStream'

ES5:

define([
	'fontoxml-pipelined-importer/ImportStream'
], function (
	ImportStream
) {
});

Type: Class

Create a new ImportStream.

The stream is able to import an input at a given position in the XML DOM. It does this using:

  • A set of input processors

  • And set of outputProcessors

The order given for the processors in the constructor will be used to execute the processors in. An example order would be:

  • Annotate Headings

  • Annotate Lists

  • Annotate Paragraphs

  • Remove softWrap

  • Add metadata for the chunks (paragraph numbering, list type, etc)

  • Transform the texts (remove capitalizations for headings, remove list ticks, remove paragraph numbering etc)

The output process runs streaming, per Chunk, stopping trying to execute processors until one of them succeeds Each processor may advance multiple chunks in the list of chunks, until done. If stopped with success, all of the processors will be run again.

  • Attempt to insert headings

  • Attempt to insert Lists

  • Attempt to insert Paragraphs

  • Fall back to plain-text Import

Constructor

# Name Type Description
1. inputProcessors Array<PipelinedImporterInputProcessor>

The processors which attempt to recognize the nature of the inputted chunks. Accepts an array of Chunks, returns another array of Chunks.

2. outputProcessors Array<PipelinedImporterOutputProcessor>

The output processors, which attempt to place the annotated chunks in the DOM. Accepts an array of chunks, a position, an chunkPosition, a blueprint and a format, Returns a boolean result. If true, the