| #
f7c6e4ac |
| 30-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add listo_open_start sibling method for GFM start numbers
Reverts the listo_open signature widening from 5a2118acc and instead adds a sibling method `listo_open_start($start = 1)` on the renderer hi
add listo_open_start sibling method for GFM start numbers
Reverts the listo_open signature widening from 5a2118acc and instead adds a sibling method `listo_open_start($start = 1)` on the renderer hierarchy. The base default delegates to listo_open() so renderers that don't override it still produce a valid (but unnumbered) list; xhtml's override emits <ol start="N">.
The handler now emits 'listo_open_start' only for ordered lists with a non-default first number; plain ordered lists keep emitting the unchanged 'listo_open' instruction. This preserves the historical listo_open / listu_open signatures (zero-arg base, $classes-only xhtml form from 2016) so the 17 plugin renderers found via codesearch keep working without modification, while still implementing GFM's "5. foo" -> <ol start="5"> rule.
show more ...
|
| #
bf6e4f0d |
| 28-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
extract AbstractListsRewriter from Lists
The list-block CallWriter rewriter mixed two concerns: a shared state machine that turns flat list_open / list_item / list_close calls into the nested listu_
extract AbstractListsRewriter from Lists
The list-block CallWriter rewriter mixed two concerns: a shared state machine that turns flat list_open / list_item / list_close calls into the nested listu_open / listo_open / listitem / listcontent shape the renderers expect, and a syntax-specific marker parser that maps the captured indent + marker text to depth/type.
Hoist the state machine onto a new abstract base class AbstractListsRewriter; Lists keeps only its DokuWiki marker parser (`*` unordered, `-` ordered, 2-space-per-level indent). The upcoming GfmLists will share the same base class with its own GFM marker parser.
The interpretSyntax contract changes shape:
protected function interpretSyntax($match, &$type): int to abstract protected function interpretSyntax(string $match): array; // returns ['depth' => int, 'type' => 'u'|'o', 'start'? => int]
The optional `start` key carries the first ordered item's number for syntaxes that support it (GFM); DokuWiki omits it and gets the default of 1. Plugins subclassing Lists that override interpretSyntax need to update — known affected: creole, markdowku, mediasyntax (per codesearch.dokuwiki.org). The migration is mechanical: replace the by-ref $type assignment and int return with an associative-array return.
The protected listStart / listOpen / listEnd dispatch methods on the old Lists are gone (renamed handleListOpen / handleListItem / handleListClose on the base class), but no plugin in the ecosystem overrides those, only interpretSyntax.
show more ...
|