| #
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 ...
|
| #
8a34b0d8 |
| 12-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
remove comment about failing tests now that the work is complete
|
| #
aa346d4b |
| 12-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
GfmSpecTest: clear acronym table in spec renderer
The default conf/acronyms.conf entries (notably FTP) get wrapped in <abbr> by the XHTML renderer's acronym() call, which the spec output never has.
GfmSpecTest: clear acronym table in spec renderer
The default conf/acronyms.conf entries (notably FTP) get wrapped in <abbr> by the XHTML renderer's acronym() call, which the spec output never has. Clearing the renderer's acronym table makes acronym() fall through to literal text, mirroring how typography substitutions are already neutralized via SpecCompatRenderer. Brings example #628 to passing without touching production wiki rendering.
show more ...
|
| #
d379b737 |
| 05-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
GfmSpecTest: neutralize DW typography for spec roundtrip
Force $conf[typography] = 0 in renderMarkdown() so the Quotes and MultiplyEntity modes are not loaded, override entity() in SpecCompatRendere
GfmSpecTest: neutralize DW typography for spec roundtrip
Force $conf[typography] = 0 in renderMarkdown() so the Quotes and MultiplyEntity modes are not loaded, override entity() in SpecCompatRenderer to emit the original match instead of the typographic glyph, and switch _xmlEntities() from ENT_QUOTES to ENT_COMPAT so `'` stays literal in body text while `"` is still escaped to ". Drops three skip entries (#308, #310, #353) that existed only to paper over the same divergence and unblocks #16, #25 and #670.
show more ...
|
| #
09f34c31 |
| 04-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
apply spec convention: → represents a tab in GfmSpecTest
CommonMark spec.txt uses U+2192 RIGHTWARDS ARROW to visually mark literal tab characters in examples (see spec.txt, "About this document"). S
apply spec convention: → represents a tab in GfmSpecTest
CommonMark spec.txt uses U+2192 RIGHTWARDS ARROW to visually mark literal tab characters in examples (see spec.txt, "About this document"). Substitute → for \t in both markdown input and expected HTML so the corpus exercises real tab handling.
Surfaced by GfmNumericEntity: example #336 (	foo) now decodes the entity to a tab and produces correct output, but the harness was comparing against literal → in the expected HTML.
show more ...
|
| #
13a62f81 |
| 04-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
rename syntax flavors 'dokuwiki' / 'markdown' to 'dw' / 'md'
Symmetry with the existing 'dw+md' / 'md+dw' setting values.
|
| #
3440a8c0 |
| 22-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add GfmMedia and extend GfmLink with image-as-label form
- New GfmMedia parses `` with the full DokuWiki media-parameter vocabulary in the URL slot (?100x200, ?right, ?nolink, ?recache,
add GfmMedia and extend GfmLink with image-as-label form
- New GfmMedia parses `` with the full DokuWiki media-parameter vocabulary in the URL slot (?100x200, ?right, ?nolink, ?recache, …). Adds `?left`/`?right`/`?center` align keywords shared with DW `{{…}}` — gives pure-Markdown users a way to align inline images. - GfmLink now also matches `[](target)` — the GFM equivalent of `[[target|{{img}}]]`. Detection is post-entry, mirroring Internallink's `^{{…}}$` check; one mode covers the whole family. - LinkDispatch trait replaced by Helpers::classifyLink and Helpers::parseMediaParameters — two pure static methods, shared by DW and GFM counterparts. - Entry patterns for GfmLink / GfmMedia simplified (permissive URL slot, handle-time parsing), following DW's Internallink style. - GfmSpecTest drives a test-only SpecCompatRenderer that emits bare <img> / <a> instead of DW's wiki-wrapped HTML, recovering 13 spec tests that previously failed/skipped only because of renderer shape.
show more ...
|
| #
8719732d |
| 22-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add GfmHeader for ATX headings (`# text` through `###### text`)
Opener must sit at column 0. GFM tolerates 0-3 spaces before the `#` but that collides with DokuWiki's 2-space-indent preformatted blo
add GfmHeader for ATX headings (`# text` through `###### text`)
Opener must sit at column 0. GFM tolerates 0-3 spaces before the `#` but that collides with DokuWiki's 2-space-indent preformatted block, so the tolerance is dropped rather than plumbed across modes.
Widen the XHTML renderer's section-node tracker from 5 slots to 6 so h6 doesn't hit "Undefined array key 5". Extend GfmSpecTest's HTML normalizer to strip DokuWiki's section-div wrappers, section-edit comments, and header id/class attributes so heading spec examples can validate semantic correctness.
show more ...
|
| #
72b2703b |
| 20-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add spec.txt-driven roundtrip test infrastructure for Markdown
Imports GitHub Flavored Markdown's test/spec.txt (671 examples combining the CommonMark baseline with GFM extensions: tables, strikethr
add spec.txt-driven roundtrip test infrastructure for Markdown
Imports GitHub Flavored Markdown's test/spec.txt (671 examples combining the CommonMark baseline with GFM extensions: tables, strikethrough, task lists, autolink, disallowed raw HTML) and runs each example as a data- provider-driven roundtrip test against DokuWiki's full parser + XHTML renderer.
Files:
_test/tests/Parsing/Markdown/SpecReader.php Parses the fenced-example format. Each example is ``` example [optional-label] ... . ... ``` delimited by 10+ backticks with a `.` separator; tracks most recent `## Heading` as section context and numbers examples sequentially from 1 to match the spec's rendered "Example N" labels.
_test/tests/Parsing/Markdown/SpecReaderTest.php Hand-crafted fixtures covering ordinary examples, section tracking, extension labels, multiline bodies, nested backticks, unclosed fences (throws).
_test/tests/Parsing/Markdown/GfmSpecTest.php Data-provider test. Renders each example's markdown through p_get_instructions + p_render('xhtml') and compares to the expected HTML with block-level-aware whitespace normalisation (DokuWiki emits \n around block tags; inline-tag whitespace is preserved because `<em>x</em> y` != `<em>x</em>y`).
_test/tests/Parsing/Markdown/gfm-spec/ spec.txt — verbatim from github/cmark-gfm, commit 587a12bb LICENSE — CC-BY-SA 4.0 full legal text README.md — upstream URL, pinned commit, resync notes skip.php — map example-number => reason for SPEC-excluded CommonMark behaviour (flanking-delimiter analysis, multiple-of-3 rule, excess-drop). Unimplemented features are NOT listed here — they show as real failures so they remain the visible TODO list.
show more ...
|