Match djot.js on five parser edge cases (djot.js PR 137 test corpus) - #264
Merged
Conversation
- Invalid characters in an attribute spec now invalidate the whole spec, which renders as literal text (block and inline paths) - A bare ":" line starts a definition list with empty term/definition - A trailing backslash at end of content produces a hard break - A bare "#" marker line continues a heading without adding content - Table separator cells must start immediately after "|"; a leading space makes the row an ordinary data row Test cases ported from the pending djot.js PR "More test case suggestions from cdjot regressions" (jgm/djot.js PR 137); expected outputs verified against djot.js main.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #264 +/- ##
============================================
+ Coverage 92.37% 92.39% +0.02%
- Complexity 3660 3668 +8
============================================
Files 109 109
Lines 10379 10407 +28
============================================
+ Hits 9588 9616 +28
Misses 791 791 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the test cases from the pending djot.js PR More test case suggestions from cdjot regressions into the official test suite and fixes the five cases where djot-php diverged from djot.js. All expected outputs were verified against djot.js main (commit 84a4b02), not just taken from the PR.
Fixes
_,:,-. Any other character (e.g.{#a<b}) invalidates the entire spec, which stays literal text instead of leaking into attribute context. Applied on the block path, the inline word-attachment path, and trailing attribute blocks after spans/links/emphasis/code. NewAttributeParser::isValid()implements the whole-spec grammar check.:starts a definition list. A:followed by end of input produces an empty<dl><dt></dt><dd></dd></dl>instead of a paragraph (fuzz-crash class found in cdjot).para\at end of input now emits<br>instead of a literal backslash. Also holds at end of a paragraph mid-document and in headings, matching djot.js.#marker line continues a heading.# h/#/# xis one heading with contenth/x(idh-x), not two sections.|.| --- | --- |(leading space) is an ordinary data row; only|---|---|promotes the previous row to a header. Trailing space before the next|remains allowed, matching djot.jspattRowSep.One existing expectation was corrected:
AttributeParserTestpreviously asserted that an invalid unquoted value (invalid=foo.bar) is skipped while keeping the remaining attributes; djot.js invalidates the whole spec, so the test now expects literal output.Notes
[x]{???}convention), that convention is preserved:[x]{#a<b}renders fully literal, while djot.js keeps the span and renders only the braces literally.| a\ |), and an empty higher-level heading between two headings sections differently (# h/##/# x).