MCPcopy
hub / github.com/yeasy/docker_practice / strip_fenced_blocks

Function strip_fenced_blocks

check_project_rules.py:51–71  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

49
50
51def strip_fenced_blocks(text: str) -> str:
52 output: list[str] = []
53 in_fence = False
54 fence_marker = ""
55 fence_len = 0
56 for line in text.splitlines():
57 match = FENCE_RE.match(line)
58 if match:
59 marker = match.group(1)
60 char = marker[0]
61 length = len(marker)
62 if not in_fence:
63 in_fence = True
64 fence_marker = char
65 fence_len = length
66 elif char == fence_marker and length >= fence_len:
67 in_fence = False
68 output.append("")
69 continue
70 output.append("" if in_fence else line)
71 return "\n".join(output)
72
73
74def check_fences(path: Path, text: str) -> list[str]:

Callers 1

check_linksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected