MCPcopy Create free account
hub / github.com/blacklanternsecurity/bbot / find_replace_markdown

Function find_replace_markdown

bbot/scripts/docs.py:108–120  ·  view source on GitHub ↗
(content, keyword, replace)

Source from the content-addressed store, hash-verified

106
107
108def find_replace_markdown(content, keyword, replace):
109 begin_re = re.compile(r"<!--\s*" + keyword + r"\s*-->", re.I)
110 end_re = re.compile(r"<!--\s*END\s+" + keyword + r"\s*-->", re.I)
111
112 begin_match = begin_re.search(content)
113 end_match = end_re.search(content)
114
115 new_content = str(content)
116 if begin_match and end_match:
117 start_index = begin_match.span()[-1] + 1
118 end_index = end_match.span()[0] - 1
119 new_content = new_content[:start_index] + enclose_tags(replace) + new_content[end_index:]
120 return new_content
121
122
123def find_replace_file(file, keyword, replace):

Callers 1

find_replace_fileFunction · 0.85

Calls 3

enclose_tagsFunction · 0.85
compileMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…