Skip to content

pdf: remove StickyHeaderTable tags before PDF generation (#22970)#22998

Merged
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-22970-to-release-8.5
Jun 4, 2026
Merged

pdf: remove StickyHeaderTable tags before PDF generation (#22970)#22998
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-22970-to-release-8.5

Conversation

@ti-chi-bot
Copy link
Copy Markdown
Member

This is an automated cherry-pick of #22970

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

qiancai and others added 4 commits June 3, 2026 10:10
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ti-chi-bot ti-chi-bot added lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jun 3, 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 helper function 'remove_sticky_header_table' in 'scripts/merge_by_toc.py' to strip '' tags for PDF output. The review feedback suggests refactoring the list and string empty checks in this function to be more idiomatic and compliant with PEP 8 guidelines.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/merge_by_toc.py
Comment on lines +217 to +218
prev_blank = len(result) > 0 and result[-1].strip() == ''
next_blank = i + 1 < len(lines) and lines[i + 1].strip() == ''
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

In Python, empty sequences are implicitly false. We can simplify len(result) > 0 to just result. Additionally, checking if a string is empty after stripping can be written more idiomatically using not string.strip() per PEP 8 guidelines.

Suggested change
prev_blank = len(result) > 0 and result[-1].strip() == ''
next_blank = i + 1 < len(lines) and lines[i + 1].strip() == ''
prev_blank = result and not result[-1].strip()
next_blank = i + 1 < len(lines) and not lines[i + 1].strip()
References
  1. PEP 8: For sequences, (strings, lists, tuples), use the fact that empty sequences are false. (link)

@qiancai
Copy link
Copy Markdown
Collaborator

qiancai commented Jun 4, 2026

/approve

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 4, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

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

The pull request process is described 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 the approved label Jun 4, 2026
@ti-chi-bot ti-chi-bot Bot merged commit 2fbe8b2 into pingcap:release-8.5 Jun 4, 2026
11 checks passed
@ti-chi-bot ti-chi-bot Bot deleted the cherry-pick-22970-to-release-8.5 branch June 4, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants