mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-17 13:32:18 +00:00
fix(docs-governance): take an indented line before '2.' for a list continuation
An indented line such as ' continued' after '1. first' continues the list item, so the '2.' after it starts the next item, and a comment there opens a block. The paragraph check took the indented line for a paragraph line and left the comment inline.
This commit is contained in:
5 files changed
+33
-7
No files matched your search
@@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool:
|
||||
|
||||
|
||||
def _continues_a_paragraph(text: str, line_start: int) -> bool:
|
||||
"""Whether the line at `line_start` follows a paragraph line, not a blank or list line."""
|
||||
"""Whether the line at `line_start` follows a paragraph line.
|
||||
|
||||
A blank line, a list or block quote line, and an indented line, which may continue a list
|
||||
item, are not taken for one.
|
||||
"""
|
||||
if line_start == 0:
|
||||
return False
|
||||
previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1]
|
||||
return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous)
|
||||
return (
|
||||
bool(previous.strip())
|
||||
and not previous[0].isspace()
|
||||
and not CONTAINER_MARKER_RE.match(previous)
|
||||
)
|
||||
|
||||
|
||||
def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"id": "hand-seeded",
|
||||
"source": "manual-curation-pending-regeneration"
|
||||
},
|
||||
"registryDigest": "ccfb8409e8e2da6ca5666259da6d79fbcf3b68b37cb7920faf535315d3193b21",
|
||||
"registryDigest": "2d1eadf78b62c0575bd0318696b9a81a385cd33af9b366b1b99085098ecb943e",
|
||||
"schemaVersion": 1,
|
||||
"triggers": {
|
||||
"skill:agent-runtime-gateway-smoke-test": [
|
||||
|
||||
@@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool:
|
||||
|
||||
|
||||
def _continues_a_paragraph(text: str, line_start: int) -> bool:
|
||||
"""Whether the line at `line_start` follows a paragraph line, not a blank or list line."""
|
||||
"""Whether the line at `line_start` follows a paragraph line.
|
||||
|
||||
A blank line, a list or block quote line, and an indented line, which may continue a list
|
||||
item, are not taken for one.
|
||||
"""
|
||||
if line_start == 0:
|
||||
return False
|
||||
previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1]
|
||||
return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous)
|
||||
return (
|
||||
bool(previous.strip())
|
||||
and not previous[0].isspace()
|
||||
and not CONTAINER_MARKER_RE.match(previous)
|
||||
)
|
||||
|
||||
|
||||
def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int:
|
||||
|
||||
@@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool:
|
||||
|
||||
|
||||
def _continues_a_paragraph(text: str, line_start: int) -> bool:
|
||||
"""Whether the line at `line_start` follows a paragraph line, not a blank or list line."""
|
||||
"""Whether the line at `line_start` follows a paragraph line.
|
||||
|
||||
A blank line, a list or block quote line, and an indented line, which may continue a list
|
||||
item, are not taken for one.
|
||||
"""
|
||||
if line_start == 0:
|
||||
return False
|
||||
previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1]
|
||||
return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous)
|
||||
return (
|
||||
bool(previous.strip())
|
||||
and not previous[0].isspace()
|
||||
and not CONTAINER_MARKER_RE.match(previous)
|
||||
)
|
||||
|
||||
|
||||
def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int:
|
||||
|
||||
@@ -298,6 +298,7 @@ def test_artifact_scope_reads_html_comments_as_commonmark_does(project: Path) ->
|
||||
# -- a list that starts at 2 cannot interrupt a paragraph; one that starts at 1 can --
|
||||
"Paragraph\n2. <!-- c --> [numbered](missing-numbered.md)\n\n"
|
||||
"1. first\n2. <!-- c --> [listed2](missing-listed2.md)\n\n"
|
||||
"1. first\n continued\n2. <!-- c --> [listed3](missing-listed3.md)\n\n"
|
||||
"Paragraph\n1. <!-- c --> [one](missing-one.md)\n\n"
|
||||
# -- after text in a list item, a comment is inline again --
|
||||
"- item <!-- c\n\n [item-real](missing-item-real.md)\n -->\n\n"
|
||||
@@ -324,6 +325,7 @@ def test_artifact_scope_reads_html_comments_as_commonmark_does(project: Path) ->
|
||||
assert "Broken Markdown link: 'guide.md' -> 'missing-item-real.md'" in result.stdout
|
||||
assert "Broken Markdown link: 'guide.md' -> 'missing-numbered.md'" in result.stdout
|
||||
assert "missing-listed2.md" not in result.stdout
|
||||
assert "missing-listed3.md" not in result.stdout
|
||||
assert "missing-one.md" not in result.stdout
|
||||
assert "missing-definition.md" not in result.stdout
|
||||
assert "Broken Markdown link: 'guide.md' -> 'missing-titled.md'" in result.stdout
|
||||
|
||||
Reference in new issue
Block a user