pdf: remove StickyHeaderTable tags before PDF generation#22970
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces a new function remove_sticky_header_table in scripts/merge_by_toc.py to strip <StickyHeaderTable> tags for PDF output. The review feedback suggests making the regular expression pattern more robust to handle self-closing tags and trailing spaces, and correcting the spacing between top-level functions to comply with PEP 8.
|
|
||
|
|
||
| # remove <StickyHeaderTable> / </StickyHeaderTable> tags for PDF output | ||
| sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable>\s*$') |
There was a problem hiding this comment.
The current regular expression only matches exact <StickyHeaderTable> and </StickyHeaderTable> tags. To make it more robust and handle potential variations such as self-closing tags (e.g., <StickyHeaderTable />) or trailing spaces inside the tag (e.g., <StickyHeaderTable >), we should update the pattern to allow optional trailing slashes and spaces before the closing bracket.
| sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable>\s*$') | |
| sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable\s*/?>\s*$') |
| return '\n'.join(result) | ||
|
|
There was a problem hiding this comment.
According to PEP 8, top-level function and class definitions should be surrounded by two blank lines. Currently, there is only one blank line between remove_sticky_header_table and remove_copyable.
| return '\n'.join(result) | |
| return '\n'.join(result) | |
References
- PEP 8: Surround top-level function and class definitions with two blank lines. (link)
|
@shhdgit: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What is changed, added or deleted? (Required)
<StickyHeaderTable>and</StickyHeaderTable>lines before PDF generation.Which TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?