Post-processing pass for paragraph merging and cleanup in the parsed AST.
This module handles two related Wikidot behaviors:
Paragraph strip (span_): In Wikidot, the [[span_]] inline element
removes paragraph boundaries around it. When a paragraph contains a span_
marker, it becomes a "merge anchor" that absorbs adjacent paragraphs. The
merged content is unwrapped (no <p> tag), matching Wikidot's rendering.
Content after a blank line inside span_ becomes "escaped" and is placed
outside the merged paragraph.
Empty [[#expr ]] paragraph splitting: An [[#expr ]] element with
an empty expression acts as a paragraph break, splitting the containing
paragraph into separate paragraphs.
Additionally, this module recursively cleans internal flags (_paragraphStrip,
_emptyParagraphStrip, _escapedFromParagraph, _splitByBlankLine) from AST
elements. These flags are used during parsing as inter-pass communication and
must not appear in the final output.
Post-processing pass for paragraph merging and cleanup in the parsed AST.
This module handles two related Wikidot behaviors:
Paragraph strip (
span_): In Wikidot, the[[span_]]inline element removes paragraph boundaries around it. When a paragraph contains aspan_marker, it becomes a "merge anchor" that absorbs adjacent paragraphs. The merged content is unwrapped (no<p>tag), matching Wikidot's rendering. Content after a blank line insidespan_becomes "escaped" and is placed outside the merged paragraph.Empty
[[#expr ]]paragraph splitting: An[[#expr ]]element with an empty expression acts as a paragraph break, splitting the containing paragraph into separate paragraphs.Additionally, this module recursively cleans internal flags (
_paragraphStrip,_emptyParagraphStrip,_escapedFromParagraph,_splitByBlankLine) from AST elements. These flags are used during parsing as inter-pass communication and must not appear in the final output.