Class: Normalizer

html2wt/normalizeDOM~Normalizer(state)

new Normalizer(state)

...
Parameters:
Name Type Description
state SerializerState
Source:

Methods

merge()

Transfer all of b's children to a and delete b.

Transfer all of b's children to a and delete b.

Source:

normalizeNode(node) → {Node}

scrubWikitext normalizations implemented right now:

  1. Tag minimization (I/B tags) in normalizeSiblingPair
  2. Strip empty headings and style tags
  3. Force SOL transparent links to serialize before/after heading
  4. Trailing spaces are migrated out of links
  5. Space is added before escapable prefixes in table cells
  6. Strip
    from headings
  7. Strip bidi chars around categories
  8. When an A tag is encountered, if there are format tags inside, move them outside

The return value from this function should respect the following contract:

  • if input node is unmodified, return it.

scrubWikitext normalizations implemented right now:

  1. Tag minimization (I/B tags) in normalizeSiblingPair
  2. Strip empty headings and style tags
  3. Force SOL transparent links to serialize before/after heading
  4. Trailing spaces are migrated out of links
  5. Space is added before escapable prefixes in table cells
  6. Strip
    from headings
  7. Strip bidi chars around categories
  8. When an A tag is encountered, if there are format tags inside, move them outside

The return value from this function should respect the following contract:

  • if input node is unmodified, return it.
  • if input node is modified, return the new node that it transforms into. If you return a node other than this, normalizations may not apply cleanly and may be skipped.
Parameters:
Name Type Description
node Node

the node to normalize

Source:
Returns:

the normalized node

Type
Node

swap()

b is a's sole non-deleted child.

b is a's sole non-deleted child. Switch them around.

Source: