Skip to content

Commit

Permalink
Not allowing to style <li> tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Feb 28, 2024
1 parent 8bab812 commit ff8165d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion docs/HTML.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pdf.output("html.pdf")

## Styling HTML tags globally

The style of several HTML tags (`<a>`, `<blockquote>`, `<code>`, `<pre>`, `<li>`, `<h1>`, `<h2>`, `<h3>`...) can be set globally, for the whole HTML document, by passing `tag_styles` to `FPDF.write_html()`:
The style of several HTML tags (`<a>`, `<blockquote>`, `<code>`, `<pre>`, `<h1>`, `<h2>`, `<h3>`...) can be set globally, for the whole HTML document, by passing `tag_styles` to `FPDF.write_html()`:

```python
from fpdf import FPDF, FontFace
Expand Down
1 change: 0 additions & 1 deletion fpdf/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"h4": FontFace(color=(150, 0, 0), size_pt=12),
"h5": FontFace(color=(150, 0, 0), size_pt=10),
"h6": FontFace(color=(150, 0, 0), size_pt=8),
"li": FontFace(color=(190, 0, 0)),
"pre": FontFace(family="Courier"),
}
DEFAULT_TAG_INDENTS = {
Expand Down
Binary file removed test/html/html_ordered_li_color.pdf
Binary file not shown.
Binary file removed test/html/html_unordered_li_color.pdf
Binary file not shown.
16 changes: 0 additions & 16 deletions test/html/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,22 +574,6 @@ def test_html_link_color(tmp_path):
assert_pdf_equal(pdf, HERE / "html_link_color.pdf", tmp_path)


def test_html_unordered_li_color(tmp_path):
pdf = FPDF()
pdf.add_page()
html = "<ul><li>foo</li></ul>"
pdf.write_html(html, tag_styles={"li": FontFace(color=color_as_decimal("lime"))})
assert_pdf_equal(pdf, HERE / "html_unordered_li_color.pdf", tmp_path)


def test_html_ordered_li_color(tmp_path):
pdf = FPDF()
pdf.add_page()
html = "<ol><li>foo</li></ol>"
pdf.write_html(html, tag_styles={"li": FontFace(color=DeviceRGB(r=0, g=1, b=0))})
assert_pdf_equal(pdf, HERE / "html_ordered_li_color.pdf", tmp_path)


def test_html_blockquote_color(tmp_path):
pdf = FPDF()
pdf.add_page()
Expand Down

0 comments on commit ff8165d

Please sign in to comment.