Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_html(): homogenization in handling of tag_styles + new optional arg font_family #1217

Merged
merged 9 commits into from
Jul 5, 2024

Conversation

Lucas-C
Copy link
Member

@Lucas-C Lucas-C commented Jul 1, 2024

This is a follow-up of the clean-up started in PR #1211

Now the following HTML tags are all handled similarly, by the same code blocks in HTML2FPDF: <b>, <blockquote>, <center>, <code>, <em>, <i>, <dd>, <dt>, <pre>, <strong>, <u>.

This PR also introduces a new optional font_family parameter to FPDF.write_html(), in order to be able to set the default font family.

Checklist:

  • The GitHub pipeline is OK (green), meaning that both pylint (static code analyzer) and black (code formatter) are happy with the changes of this PR.

  • A unit test is covering the code added / modified by this PR

  • This PR is ready to be merged

  • [NA] In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder

  • [NA] A mention of the change is present in CHANGELOG.md

@Lucas-C
Copy link
Member Author

Lucas-C commented Jul 1, 2024

@gmischler, @lcgeneralprojects: this PR is ready for review if you want to have a look at it 🙂

I'm wondering if I should try to get rid of .font_family / .font_size / .emphasis / .style_stack in HTML2FPDF as part of this PR...

@Lucas-C Lucas-C force-pushed the html-homogenization branch from db9a009 to c167f59 Compare July 1, 2024 13:54
@Lucas-C Lucas-C force-pushed the html-homogenization branch from c167f59 to 80d01d1 Compare July 1, 2024 13:55
Copy link
Collaborator

@gmischler gmischler left a comment

Choose a reason for hiding this comment

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

There's some stuff in there that I don't understand. Which may be me not looking straight, or there may actually be problems... 😉

fpdf/fpdf.py Show resolved Hide resolved
fpdf/html.py Show resolved Hide resolved
fpdf/html.py Outdated Show resolved Hide resolved
fpdf/html.py Outdated Show resolved Hide resolved
fpdf/html.py Outdated Show resolved Hide resolved
@Lucas-C Lucas-C force-pushed the html-homogenization branch from 27dbd88 to 8b9d685 Compare July 2, 2024 11:55
@Lucas-C Lucas-C force-pushed the html-homogenization branch from 8b9d685 to a3792ea Compare July 2, 2024 11:56
@Lucas-C Lucas-C changed the title write_html(): homogenization in handling of tag_styles write_html(): homogenization in handling of tag_styles + new optional arg font_family Jul 2, 2024
@Lucas-C Lucas-C force-pushed the html-homogenization branch 5 times, most recently from 66fd0a0 to 2c37f77 Compare July 5, 2024 21:18
@Lucas-C Lucas-C force-pushed the html-homogenization branch from 2c37f77 to 1a76aa7 Compare July 5, 2024 21:18
@Lucas-C Lucas-C merged commit 6f7a207 into master Jul 5, 2024
13 checks passed
@Lucas-C Lucas-C deleted the html-homogenization branch July 5, 2024 21:24
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