File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,6 +214,27 @@ def replace_heading(match):
214214 return replace_heading
215215
216216
217+ # remove <StickyHeaderTable> / </StickyHeaderTable> tags for PDF output
218+ sticky_header_table_pattern = re .compile (r'^\s*</?StickyHeaderTable\s*/?>\s*$' )
219+
220+ def remove_sticky_header_table (text ):
221+ lines = text .split ('\n ' )
222+ result = []
223+ i = 0
224+ while i < len (lines ):
225+ if sticky_header_table_pattern .match (lines [i ]):
226+ prev_blank = len (result ) > 0 and result [- 1 ].strip () == ''
227+ next_blank = i + 1 < len (lines ) and lines [i + 1 ].strip () == ''
228+ if prev_blank and next_blank :
229+ i += 2
230+ else :
231+ i += 1
232+ else :
233+ result .append (lines [i ])
234+ i += 1
235+ return '\n ' .join (result )
236+
237+
217238# remove copyable snippet code
218239def remove_copyable (match ):
219240 return ""
@@ -233,6 +254,7 @@ def remove_copyable(match):
233254 chapter = replace_variables (chapter , variables )
234255 chapter = replace_link_wrap (chapter , name )
235256 chapter = copyable_snippet_pattern .sub (remove_copyable , chapter )
257+ chapter = remove_sticky_header_table (chapter )
236258 chapter = extract_custom_ids_and_clean (chapter )
237259 chapter = replace_custom_id_links (chapter )
238260 # This block is to filter <CustomContent paltform="xxx"> xxx </CustomContent>
You can’t perform that action at this time.
0 commit comments