Home
last modified time | relevance | path

Searched hist:bf6e4f0d2bea6ff572294f3280faef71d44e0917 (Results 1 – 2 of 2) sorted by relevance

/dokuwiki/inc/Parsing/Handler/
H A DAbstractListsRewriter.phpbf6e4f0d2bea6ff572294f3280faef71d44e0917 Tue Apr 28 06:21:05 UTC 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_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.

H A DLists.phpbf6e4f0d2bea6ff572294f3280faef71d44e0917 Tue Apr 28 06:21:05 UTC 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_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.