History log of /dokuwiki/inc/parserutils.php (Results 1 – 25 of 187)
Revision Date Author Comments
# 2e43b799 04-Jun-2026 Andreas Gohr <gohr@cosmocode.de>

Render locale and plugin-bundled text as DokuWiki syntax

Static "intro" text shipped with DokuWiki, templates and plugins —
inc/lang/*/*.txt, template locale files, each plugin's lang/<lc>/*.txt —
i

Render locale and plugin-bundled text as DokuWiki syntax

Static "intro" text shipped with DokuWiki, templates and plugins —
inc/lang/*/*.txt, template locale files, each plugin's lang/<lc>/*.txt —
is authored in DokuWiki syntax. It is a core/plugin asset, not user
content. When an admin configures the wiki for Markdown the DW link and
monospace modes are not loaded, so these files render as literal text:
[[wiki:syntax]] and ''Save'' pairs survive into the HTML.

Pin those entry points to the 'dw' flavour via the override added in the
previous commit:

- p_locale_xhtml() and tpl_locale_xhtml() pass 'dw'.
- PluginTrait::locale_xhtml() passes 'dw'.
- PluginTrait::render_text() / PluginInterface::render_text() gain a
$syntax parameter defaulting to 'dw'. The default is 'dw', not null,
because the method predates GFM and its callers pass DW-syntax strings;
plugins rendering user content opt back into the configured syntax with
render_text($text, 'xhtml', null).

Locale output is now deterministic across a syntax switch, so its caches
get over-invalidated but never under-invalidated — acceptable, as the
locale render path is rare and cheap.

show more ...


# 16999ed1 04-Jun-2026 Andreas Gohr <gohr@cosmocode.de>

parserutils: allow callers to override the parse syntax, key cache on it

With the registry now carrying the flavour as a parameter, expose that
to callers: p_get_instructions(), p_cached_instruction

parserutils: allow callers to override the parse syntax, key cache on it

With the registry now carrying the flavour as a parameter, expose that
to callers: p_get_instructions(), p_cached_instructions() and
p_cached_output() gain an optional $syntax argument. null (the default)
means "use the configured $conf['syntax']", preserving behaviour for
every existing call site; an explicit flavour parses under it regardless
of the wiki's configured preference.

This is what lets bundled assets render deterministically — e.g. a
plugin forcing 'dw' on a document whose configured syntax is 'md'.

Because that case renders the same file under two flavours within one
request, key both the in-request memo (the $run map) and the on-disk
cache on $syntax so the two do not collide. The syntax enters the cache
key only when passed explicitly (non-null); when null the key is
unchanged, so existing caches are untouched. Plumbed through new
optional $syntax args on CacheParser / CacheInstructions, appended to
the key string.

show more ...


# 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 ...


# 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 ...


# 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 ...


# 743a6908 11-Apr-2026 splitbrain <86426+splitbrain@users.noreply.github.com>

�� Rector and PHPCS fixes


# 093fe67e 07-Mar-2026 Andreas Gohr <andi@splitbrain.org>

updated rector and applied it


# 99a0b426 22-Nov-2024 Andreas Gohr <andi@splitbrain.org>

mark nullable types explicitly

PHP 8.4 will throw a warning where type hints without a ?prefix are used
and nullable parameters can be passed.

I'm not sure if I found all occurances, but we still r

mark nullable types explicitly

PHP 8.4 will throw a warning where type hints without a ?prefix are used
and nullable parameters can be passed.

I'm not sure if I found all occurances, but we still rarely use type
hints, so it might not be many indeed.

show more ...


# 7a83f336 14-Nov-2023 Andreas Gohr <andi@splitbrain.org>

Merge pull request #4010 from maulanaaghnii/parserutilswarning

Parserutils Warning


# e6a82646 03-Sep-2023 Andreas Gohr <andi@splitbrain.org>

fix syntax plugin loading

It turns out our Syntax plugins never implemented the PluginInterface
(though they did use the PluginTrait). With our stricter type checking
in the plugin loader, these plu

fix syntax plugin loading

It turns out our Syntax plugins never implemented the PluginInterface
(though they did use the PluginTrait). With our stricter type checking
in the plugin loader, these plugins did not longer load.

show more ...


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

code style: line breaks


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

coding style: control flow line breaks


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

coding style: control flow whitespaces


# 73022918 30-Aug-2023 Andreas Gohr <andi@splitbrain.org>

coding style: PSR12.Classes.ClassInstantiation.MissingParentheses


# 316e3ee6 30-Aug-2023 Andreas Gohr <andi@splitbrain.org>

codestyle adjustments: EOF new lines


# 51bc2534 29-Aug-2023 Andreas Gohr <andi@splitbrain.org>

fix codesniffer violations


# 24870174 29-Aug-2023 Andreas Gohr <andi@splitbrain.org>

Apply rector fixes to the rest of inc


# fa1a0dc6 10-Jul-2023 TB Maulana Aghni <tubagus.maulana@runsystem.id>

Parserutils Warning


# 78b498a7 10-Mar-2023 Andreas Gohr <andi@splitbrain.org>

clean up parserutils (reformatting mostly)


# abca2f79 10-Mar-2023 Eduardo Mozart de Oliveira <2974895+eduardomozart@users.noreply.github.com>

Fix warning on PHP8+ when using the DokuWiki stylemanager

Fix PHP Warning message of "Trying to access array offset on value of type null" at the bottom of DokuWiki Config Style page. Fixes #3883


# bbe6b3a7 12-Oct-2022 Andreas Gohr <andi@splitbrain.org>

Remove the htmlok and phpok embedding options

Both options have grave security implications and novice users seem to
ignore advice about them. In the last decades I never came across a wiki
that had

Remove the htmlok and phpok embedding options

Both options have grave security implications and novice users seem to
ignore advice about them. In the last decades I never came across a wiki
that had legitimate use of these options.

If someone needs the functionality, it can easily be added back using a
plugin. But I prefer to give users one less option to shoot themselves
in the foot.

Removal of the translations for the config strings can follow after this
has been merged.

show more ...


# 65f6b58f 08-Jan-2022 Anna Dabrowska <dabrowska@cosmocode.de>

Allow more modifications in p_locale_xhtml event


# 6d0b5208 05-Jan-2022 Anna Dabrowska <dabrowska@cosmocode.de>

Include id in event data


# 75b4d506 05-Jan-2022 Anna Dabrowska <dabrowska@cosmocode.de>

Add event to p_locale_xhtml()

Allows plugins to modify localized text


# 056bf31f 06-Feb-2021 Damien Regad <dregad@mantisbt.org>

Fix various errors in PHPUnit tests on PHP 8


12345678