Skip to content

write_html: continue lettered list markers past z instead of raising … - #1987

Merged
andersonhc merged 3 commits into
py-pdf:masterfrom
RavSinghChandan:html-ol-letters-past-z
Oct 10, 2026
Merged

andersonhc merged 3 commits into
py-pdf:masterfrom
RavSinghChandan:html-ol-letters-past-z

Conversation

@RavSinghChandan

Copy link
Copy Markdown

Any <ol type="a"> or <ol type="A"> list with more than 26 items made write_html() raise IndexError: string index out of range, because ol_prefix() indexed ascii_lowercase directly. A list with start="26" failed on its second item.

Lettered markers now continue the way browsers render them: a … z, aa, ab … az, ba, and so on. A start below 1 shows as a number, as browsers do; before, start="0" printed "z".

Checklist:

  • A unit test is covering the code added / modified by this PR
  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder (N/A, bug fix)
  • A mention of the change is present in CHANGELOG.md
  • This PR is ready to be merged

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

Comment thread fpdf/html.py Resolved
@RavSinghChandan

Copy link
Copy Markdown
Author

Done, thanks! int_to_letters() now uses the iterative divmod version with the same zero-based interface (it gives identical results to the old one for 0-199999, so page labels are unchanged), and ol_prefix() calls it, returning the index as-is below 1 and lowercasing for type="a". I removed _alphabetic() and added a small test for int_to_letters(). Thanks also for the typos.toml fix.

@andersonhc andersonhc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ready to merge. Thank you.

@andersonhc
andersonhc merged commit d13c915 into py-pdf:master Oct 10, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants