Fixing: bullet/top_margin combo & width of indented paragraphs & some HTML bugs#1218
Open
gmischler wants to merge 1 commit intopy-pdf:masterfrom
Open
Fixing: bullet/top_margin combo & width of indented paragraphs & some HTML bugs#1218gmischler wants to merge 1 commit intopy-pdf:masterfrom
gmischler wants to merge 1 commit intopy-pdf:masterfrom
Conversation
Lucas-C
requested changes
Oct 14, 2024
Member
Lucas-C
left a comment
There was a problem hiding this comment.
You mentioned a change in fpdf/html.py in your PR description, but I do not see it in the PR diff 🙂
| self.balance = balance | ||
| total_w = self.extents.right - self.extents.left | ||
| col_width = (total_w - (ncols - 1) * gutter) / ncols | ||
| self.h_margins = (pdf.c_margin, pdf.c_margin) |
Member
There was a problem hiding this comment.
Given the current usage of this attribute, I wonder if having 2 distincts attributes .l_margin & .r_margin would not make the code & intent clearer there? 🙂
Comment on lines
+333
to
+335
| """Ensure that the top/bottom margins work with indented/bulleted | ||
| paragraphs. | ||
| Ensure that indented paragraphs have a reduced total width. |
| self.pdf.c_margin + (self.indent - fragments_width - bullet_r_margin), | ||
| self.pdf.c_margin, | ||
| self._region.h_margins[0] | ||
| + (self.indent - fragments_width - bullet_r_margin), |
Member
There was a problem hiding this comment.
Shouldn't indent=self.indent be provided there, instead of adding self.indent to the left margin?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes:
_ln()for<li>to top_margin value in html.py. Some HTML tests need a t_margin value added to their TextStyle to avoid automatic empty lines in_new_paragraph().ln()of the text regions didn't always do what it is supposed to do with an explicit height given. This resulted in the "2mm" specification to simply be ignored, so that the layout of lists will now include a slightly wider gap, as was initially intended.Checklist:
meaning that both
pylint(static code analyzer) andblack(code formatter) are happy with the changes of this PR.docs/folderCHANGELOG.mdBy submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.