-
Notifications
You must be signed in to change notification settings - Fork 254
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
Split handling of HTML attributes & style CSS properties #1211
Conversation
c4fb45f
to
9dcea81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
Note that svg.py uses parse_style()
as well and will need to be adapted.
Also, maybe rename to parse_css_style()
?
9dcea81
to
4a0dab5
Compare
Agreed! Good idea. |
d540a4f
to
c38e2e0
Compare
6c8505d
to
a6e9e9e
Compare
a4cbf6d
to
cc6df3a
Compare
Quoting @gmischler in a comment above:
There is some truth in this. At this point, I think that this PR is "good-enough" to be merged, and we could perform more improvements in later PRs. Still, I'd be happy to merge this, because:
|
cc6df3a
to
c7ea250
Compare
@lcgeneralprojects : I'd be happy to have your review / feedbacks on this, given that you previously worked on |
c7ea250
to
b18b2fc
Compare
b18b2fc
to
2d09df2
Compare
I don't have a very detailled idea of how the optimal API would look like. There are quite a lof of places that could be equipped with styling (traditional text, HTML tags, table cells/rows/columns, text regions, paragraphs, etc.), all with some common requirements, but also a lot of sometimes subtle differences. My point is that when adding a new option, the way of thinking should always be "could this be used elsewhere? What would need to be different for that?". It looks like with your changes we're a lot closer to that than before.
Never say never... 😉 |
Will try to help, unless it's too late. |
I merged this PR, but your review is still very welcome! |
I do like the generalisation and unification of text style management. I also have to say that I am grateful for being mentioned in the changelog. I won't have time to delve in-depth into the new stuff until at least two more days, but the apparent reduction of 'special cases' seems nice. |
Thank you very much for the feedback @lcgeneralprojects! 👍 |
This PR is a follow-up of the clean-up started there: #1217 |
This PR also:
fpdf.TitleStyle
class intofonts.TextStyle
tag_indents
in favour oftag_styles
FontFace
andTextStyle
instances to be provided astag_styles
heading_above
&heading_below
parameters (not released yet), now handled by.t_margin
&.b_margin
of HTML tags'TextStyle
settingslist_vertical_margin
parameter (not released yet), now handled by.t_margin
<ol>
&<ul>
TextStyle
settingsfpdf/html.py
Checklist:
The GitHub pipeline is OK (green),
meaning that both
pylint
(static code analyzer) andblack
(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
In case of a new feature, docstrings have been added, with also some documentation in the
docs/
folderA mention of the change is present in
CHANGELOG.md
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.