mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
fix(block-ci): mask code spans that wrap lines before matching links
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c8d8d3a14
commit
eeef10aeb2
2 files changed
+6
-3
No files matched your search
@@ -10,7 +10,7 @@ import urllib.parse
|
||||
|
||||
SKIP_DIRS = {".git", "node_modules", "vendor"}
|
||||
FENCE = re.compile(r"^\s*(`{3,}|~{3,})(.*)$")
|
||||
INLINE_CODE = re.compile(r"(`+)(?:(?!\1).)+?\1")
|
||||
INLINE_CODE = re.compile(r"(`+)(?:(?!\1).)+?\1", re.S)
|
||||
INLINE_LINK = re.compile(r"!?\[(?:[^\[\]]|\[[^\[\]]*\])*\]\(\s*(<[^>\n]*>|(?:[^\s()]|\([^\s()]*\))+)")
|
||||
REFERENCE = re.compile(r"^[ \t]{0,3}\[[^\]]+\]:\s*(<[^>]*>|\S+)", re.M)
|
||||
SCHEME = re.compile(r"^[A-Za-z][A-Za-z0-9+.-]*:")
|
||||
@@ -18,7 +18,7 @@ SCHEME = re.compile(r"^[A-Za-z][A-Za-z0-9+.-]*:")
|
||||
|
||||
def paragraph_targets(first, lines):
|
||||
# A link label may wrap, so links are matched per paragraph.
|
||||
text = INLINE_CODE.sub("", "\n".join(lines))
|
||||
text = INLINE_CODE.sub(lambda m: "\n" * m.group().count("\n"), "\n".join(lines))
|
||||
found = [(m.start(), m.group(1)) for regex in (INLINE_LINK, REFERENCE) for m in regex.finditer(text)]
|
||||
for pos, target in sorted(found):
|
||||
yield first + text.count("\n", 0, pos), target
|
||||
|
||||
Reference in new issue
Block a user