MCPcopy Index your code
hub / github.com/pingcap/docs-cn / remove_sticky_header_table

Function remove_sticky_header_table

scripts/merge_by_toc.py:198–213  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

196sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable\s*/?>\s*$')
197
198def remove_sticky_header_table(text):
199 lines = text.split('\n')
200 result = []
201 i = 0
202 while i < len(lines):
203 if sticky_header_table_pattern.match(lines[i]):
204 prev_blank = len(result) > 0 and result[-1].strip() == ''
205 next_blank = i + 1 < len(lines) and lines[i + 1].strip() == ''
206 if prev_blank and next_blank:
207 i += 2
208 else:
209 i += 1
210 else:
211 result.append(lines[i])
212 i += 1
213 return '\n'.join(result)
214
215
216# remove copyable snippet code

Callers 1

merge_by_toc.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected