Merge and split paragraphs according to Wikidot's span_ and expr behaviors.
This is the main post-processing entry point for paragraph restructuring.
It performs two passes over the top-level element list:
First pass: Split paragraphs at _splitByBlankLine spans and empty [[#expr ]]
elements. A single input paragraph may become multiple output paragraphs.
Second pass: Merge consecutive paragraphs around span_ markers. When a
paragraph contains a span_ marker, it absorbs adjacent paragraphs (even those
without span_). The merged content is unwrapped (no <p> tag), matching
Wikidot's rendering behavior. Escaped spans (content after blank lines in span_)
are extracted and placed outside the merged paragraph.
Merge and split paragraphs according to Wikidot's
span_and expr behaviors.This is the main post-processing entry point for paragraph restructuring. It performs two passes over the top-level element list:
First pass: Split paragraphs at
_splitByBlankLinespans and empty[[#expr ]]elements. A single input paragraph may become multiple output paragraphs.Second pass: Merge consecutive paragraphs around
span_markers. When a paragraph contains aspan_marker, it absorbs adjacent paragraphs (even those withoutspan_). The merged content is unwrapped (no<p>tag), matching Wikidot's rendering behavior. Escaped spans (content after blank lines inspan_) are extracted and placed outside the merged paragraph.