History log of /dokuwiki/inc/Parsing/ParserMode/Listblock.php (Results 1 – 9 of 9)
Revision Date Author Comments
# 47a02a10 04-Jun-2026 Andreas Gohr <gohr@cosmocode.de>

Parsing: make parse syntax a per-parse value, drop ModeInterface

The active parse's syntax flavour is a per-parse question, not process-
global state: within a single request a plugin can render bun

Parsing: make parse syntax a per-parse value, drop ModeInterface

The active parse's syntax flavour is a per-parse question, not process-
global state: within a single request a plugin can render bundled
DokuWiki-syntax text inside an otherwise-Markdown page. Yet ModeRegistry
was a singleton that read $conf['syntax'] and the $PARSER_MODES global,
and every mode reached it through ModeRegistry::getInstance() — so the
flavour lived in shared mutable state that two parses in one request
would fight over.

Make the registry a short-lived value instead:

- ModeRegistry is constructed once per parse with an explicit $syntax
and injected into Parser, Handler and every mode. getSyntax() /
isDwPreferred() / isMdPreferred() consult $this->syntax; the
DOKU_UNITTEST-gated mode-list cache hack is gone (each registry is
fresh, nothing to invalidate).
- p_get_instructions() is now the single place in the pipeline where
$conf['syntax'] is read; from there the flavour travels as a
parameter. No code under inc/Parsing/ reads $conf['syntax'] directly
anymore — the five syntax-reading modes (Preformatted, GfmHr,
GfmEscape, Externallink, GfmQuote) route through $this->registry.

Keep the two concepts apart, as documented in the ModeRegistry and
AbstractMode docblocks: the user's configured *preference* stays in
$conf['syntax'] for UI code (toolbar, settings), while the active
parse's syntax is a parameter carried by the registry.

$PARSER_MODES is demoted to a deprecated, read-only mirror, published
during loadPluginModes() — third-party syntax plugins (columnlist,
alphalist2, phpwikify, skipentity) and the bundled info plugin read the
global directly, often from their constructors, so the taxonomy must
stay visible there. No core code reads the mirror.

Fold ModeInterface into AbstractMode while here: getSort()/handle() are
abstract, the connect callbacks carry defaults, and the public $Lexer
"FIXME should be done by setter" becomes setLexer()/getLexer() injected
by Parser::addMode() alongside the registry. Nested-content resolution
moves to the allowedCategories()/filterAllowedModes() hooks, resolved
once when the registry is attached.

Tests build their own parser/registry through ParserTestBase::setSyntax()
instead of mutating $conf and calling the removed ModeRegistry::reset().

show more ...


# 06ab3bb2 12-May-2026 Andreas Gohr <andi@splitbrain.org>

Merge branch 'master' into gfm

* master: (176 commits)
Delete inc/Search/concept.txt
�� Rector and PHPCS fixes
�� Update deleted files
updated phpseclib dependency
use new ModeRegistry con

Merge branch 'master' into gfm

* master: (176 commits)
Delete inc/Search/concept.txt
�� Rector and PHPCS fixes
�� Update deleted files
updated phpseclib dependency
use new ModeRegistry constant in info plugin
keep historic typo in value but not in constant
SearchIndex: fix comment position
�� Rector and PHPCS fixes
Translation update (tr)
Translation update (fr)
refactor(changelog): persist external-edit detection on first read
fix(infoutils): escape git log arguments for Windows compatibility
fix(preview): remove deprecated X-XSS-Protection header
fix: don't move the editor textarea into the toolbar
fix EXIF-rotated images shown cropped in previews, closes #4482
fix: avoid picker close/reopen race on toggle button click
subscriptions: include diff link in plain-text list mails too
Translation update (ru)
Translation update (pl)
Translation update (pt-br)
...

# Conflicts:
# inc/Parsing/ParserMode/Quote.php

show more ...


# 56c730b5 06-May-2026 Andreas Gohr <andi@splitbrain.org>

keep historic typo in value but not in constant

We need to keep the historic typo in the value ("substition"), but there
is no reason to keep it in the constant.


# 96d096f1 27-Apr-2026 Andreas Gohr <andi@splitbrain.org>

remove getLineStartMarkers registry — sort order already wins

Preformatted's entry pattern carried a `(?![\*\-])` negative
lookahead to defer to list modes on indented bullet lines.
0cecf9d50 (2005,

remove getLineStartMarkers registry — sort order already wins

Preformatted's entry pattern carried a `(?![\*\-])` negative
lookahead to defer to list modes on indented bullet lines.
0cecf9d50 (2005, "new parser added") introduced it hardcoded;
7958e6980 (2026, "decouple hardcoded mode names in Eol and
Preformatted") refactored that hardcoded knowledge into
register/getLineStartMarkers on ModeRegistry so each list mode
owned its marker chars. Both preserved the behavior verbatim;
neither documented why it was needed.

Tracing the lexer, it isn't. ParallelRegex merges all entry
patterns into one PCRE expression; PCRE returns the leftmost
match and breaks ties on expression order. Modes are added in
sort order via ModeRegistry::getModes(), so Listblock (sort 10)
always precedes Preformatted (sort 20) and wins the tie on
" - foo" without any lookahead. The only test that caught a
difference was testPreformattedList, which happened to register
modes in non-canonical order - that was a test bug.

This patch drops the lookahead in Preformatted::connectTo, the
registerLineStartMarkers call in Listblock::preConnect, the
register/getLineStartMarkers methods on ModeRegistry, and the
three registry-API unit tests. testPreformattedList now
registers Listblock before Preformatted.

show more ...


# 71096e46 18-Apr-2026 Andreas Gohr <andi@splitbrain.org>

move handler methods into ParserMode classes and rename Handler

Each ParserMode class now implements handle() from ModeInterface,
containing the token handling logic that previously lived as individ

move handler methods into ParserMode classes and rename Handler

Each ParserMode class now implements handle() from ModeInterface,
containing the token handling logic that previously lived as individual
methods on Doku_Handler.

The Handler class (formerly Doku_Handler) is the single dispatch point:
Lexer passes tokens to Handler::handleToken() which routes to mode
objects, plugins, or returns false. The Lexer only tokenizes and
resolves mapHandler aliases.

Key changes:
- Add handle() to ModeInterface, implemented by all mode classes
- Move Doku_Handler to dokuwiki\Parsing\Handler namespace
- File extends Code (shared parsing via $type property)
- Quotes uses mapHandler() + Handler::getModeName() for sub-modes
- Media::parseMedia() replaces Doku_Handler_Parse_Media()
- Code::parseHighlightOptions() replaces parse_highlight_options()
- Per-parse state (footnote, doublequote) stays on Handler
- Deprecated wrappers kept for base/header/internallink/media
- Class alias and rector rules added for backward compatibility

show more ...


# 7958e698 16-Apr-2026 Andreas Gohr <andi@splitbrain.org>

decouple hardcoded mode names in Eol and Preformatted

Eol.php hardcoded ['listblock', 'table'] as modes to skip, and
Preformatted.php hardcoded [\*\-] as a negative lookahead for list
markers. Both

decouple hardcoded mode names in Eol and Preformatted

Eol.php hardcoded ['listblock', 'table'] as modes to skip, and
Preformatted.php hardcoded [\*\-] as a negative lookahead for list
markers. Both embed knowledge that belongs to the respective block
modes, not to Eol/Preformatted. Adding a new block mode that handles
its own EOL or uses different line start markers would require editing
these unrelated files — a hidden coupling.

Listblock and Table now register themselves on ModeRegistry during
preConnect(). Eol queries getBlockEolModes() and Preformatted queries
getLineStartMarkers() to build its lookahead dynamically. Each mode
owns its own data, and new block modes can participate without touching
unrelated files.

show more ...


# c8dd1b9d 16-Apr-2026 Andreas Gohr <andi@splitbrain.org>

introduce ModeRegistry to encapsulate parser mode categories

Replace the global $PARSER_MODES definition in inc/parser/parser.php
with a ModeRegistry singleton that initializes and manages the mode

introduce ModeRegistry to encapsulate parser mode categories

Replace the global $PARSER_MODES definition in inc/parser/parser.php
with a ModeRegistry singleton that initializes and manages the mode
categories. The global array is still populated for backward
compatibility with plugins that access it directly.

Mode constructors now use ModeRegistry::getModesForCategories()
instead of accessing the global directly. p_get_parsermodes() and
p_sort_modes() are moved to inc/deprecated.php as thin wrappers.

show more ...


# d4f83172 31-Aug-2023 Andreas Gohr <andi@splitbrain.org>

code style: line breaks


# be906b56 04-May-2018 Andreas Gohr <andi@splitbrain.org>

moved all parsing related namespaces to their own