From ff8165de76423a141882af93022f96f16b2ecebb Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:36:17 +0100 Subject: [PATCH] Not allowing to style
  • tags --- docs/HTML.md | 2 +- fpdf/html.py | 1 - test/html/html_ordered_li_color.pdf | Bin 995 -> 0 bytes test/html/html_unordered_li_color.pdf | Bin 995 -> 0 bytes test/html/test_html.py | 16 ---------------- 5 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 test/html/html_ordered_li_color.pdf delete mode 100644 test/html/html_unordered_li_color.pdf diff --git a/docs/HTML.md b/docs/HTML.md index 3c076e28a..e653ce8f6 100644 --- a/docs/HTML.md +++ b/docs/HTML.md @@ -73,7 +73,7 @@ pdf.output("html.pdf") ## Styling HTML tags globally -The style of several HTML tags (``, `
    `, ``, `
    `, `
  • `, `

    `, `

    `, `

    `...) can be set globally, for the whole HTML document, by passing `tag_styles` to `FPDF.write_html()`: +The style of several HTML tags (``, `
    `, ``, `
    `, `

    `, `

    `, `

    `...) can be set globally, for the whole HTML document, by passing `tag_styles` to `FPDF.write_html()`: ```python from fpdf import FPDF, FontFace diff --git a/fpdf/html.py b/fpdf/html.py index 8cb84c84f..be17c635d 100644 --- a/fpdf/html.py +++ b/fpdf/html.py @@ -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 = { diff --git a/test/html/html_ordered_li_color.pdf b/test/html/html_ordered_li_color.pdf deleted file mode 100644 index 7a6d40a794975dffa6d8ea9a5961a2dfd939f88b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 995 zcmah|&ubGw6o!JJbELHz--Rx#oLLk}AYG|b)DGG)jw#hVE-OQBTiKL!9 z=%F_c9u*{@9*R`|3lD;L7QuhOiuO`(&g6$(?4fg+-S5r&-uJ$FvrzYg99gmu0RzOw zeN-$W?1=%FKoDMzIw`a)6>6*_e4BNmup)-gG8AIF_L50~=E)LuRdj88ivg~OU6!I! z2{GQ$bY_Njb&K(GTSkIUIROWeyajv^$BICwu7ulSAOWv(=81UF=My*uEw3>v;)ODd zMK@DMOFUA~CF3%M{3NFyChB*_&|s+;ByE<0lcm(fGkiLA#ur4fWQo!mhm!fMEjkS0 z6~?==2bAihR3R$Y{Lc@c;{DOa-e`wjJ#+T!uilSR@9@oB?%|!?=gWUS$MOEDC%@0_YA>fH zrmorxpPLnS>Tr6QpXhp;A!mD;q1*-J9;U^$cwxL+dHm^fdU& zSGeZiAg<#Q(;~z*)VfF9MZ;LUo=F}iY!ewkk&aImIJRxsun9+)3*!**Bg|FZ=#{~U zd;FYPIF98ldMwwrR2%>CIi{MK877l3idiy#OwH&KQ<8B*2nqT*s4=ebO##{p{p~}m x=-8A7)qJH)y{en{e9N$?;T4R6VG+ml^QDtdj9pG;n8>kB4z=7Zk{X=5VqZkc zh=75=03=5Kif$d*qAtv^fS3^c1Ki~YvBjEW91ARY*WwKj*Pa?PATAKFr*18l@Mip zMQ5aF8>f_&dm`j)!3o$4#RFjDD3Sy!bw4=cV*$9qsLP}Ah|S>ylstb~#0^9c@nNcr zlDJaO1Z5%tbDq--V)?sd@M*%wagQdDPgAPmDL$3D^$NLoFeaeR7 z1Z-O+B_gK52u(f^|L0d@O02`|w-_BvpOdy`UJ|XjRd1bM{c@+hfo|OVvD3-E>vq2H zyubVEV|F{cz4`3m{NG%LZ{f9MNRY=c7Q{R%23V$cBIqLsn)KQ*Nu^Mz rnVw@CR@t;G2FcsCvQ}^_hFdjB>HjBYE+-<0#muI>ZJ|u2*6`3DGIbBf diff --git a/test/html/test_html.py b/test/html/test_html.py index cc8ad8f8a..efda78936 100644 --- a/test/html/test_html.py +++ b/test/html/test_html.py @@ -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 = "
    • foo
    " - 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 = "
    1. foo
    " - 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()