Skip to content

pdf: remove StickyHeaderTable tags before PDF generation#22970

Open
qiancai wants to merge 2 commits into
pingcap:masterfrom
qiancai:pdf-remove-sticky-header-tag
Open

pdf: remove StickyHeaderTable tags before PDF generation#22970
qiancai wants to merge 2 commits into
pingcap:masterfrom
qiancai:pdf-remove-sticky-header-tag

Conversation

@qiancai
Copy link
Copy Markdown
Collaborator

@qiancai qiancai commented May 29, 2026

What is changed, added or deleted? (Required)

  • Remove standalone <StickyHeaderTable> and </StickyHeaderTable> lines before PDF generation.
  • If either tag is surrounded by blank lines, remove the blank line after the tag together with the tag line, so the merged Markdown does not leave extra empty rows that affect PDF rendering.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lance6716 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 29, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/merge_by_toc.py Outdated


# remove <StickyHeaderTable> / </StickyHeaderTable> tags for PDF output
sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable>\s*$')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable>\s*$')
sticky_header_table_pattern = re.compile(r'^\s*</?StickyHeaderTable\s*/?>\s*$')

Comment thread scripts/merge_by_toc.py
Comment on lines +235 to +236
return '\n'.join(result)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

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.

Suggested change
return '\n'.join(result)
return '\n'.join(result)
References
  1. PEP 8: Surround top-level function and class definitions with two blank lines. (link)

@qiancai qiancai self-assigned this May 29, 2026
@qiancai qiancai added the translation/no-need No need to translate this PR. label May 29, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label May 29, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 29, 2026

@shhdgit: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/no-need No need to translate this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants