(content, keyword, replace)
| 106 | |
| 107 | |
| 108 | def 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 | |
| 123 | def find_replace_file(file, keyword, replace): |
no test coverage detected
searching dependent graphs…