REF: io/formats/html.py (and io/formats/format.py)
State: closed

- [ n/a] follow-on #24637
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ n/a] whatsnew entry

this refactor further limits responsibilities of functions/module and should allow a simpler implementation for fixes of #17004, #9690 etc.

Labels:
name: Refactor
description: Internal refactoring of code
name: IO HTML
description: read_html, to_html, Styler.apply, Styler.applymap

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=h1) Report
> Merging [#24651](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/88ca968ff95583678f257bcad08c821e9f0f82c7?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24651/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24651      +/-   ##
==========================================
+ Coverage   92.37%   92.37%   +<.01%     
==========================================
  Files         166      166              
  Lines       52384    52386       +2     
==========================================
+ Hits        48390    48392       +2     
  Misses       3994     3994
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.8% <100%> (ø)` | :arrow_up: |
| #single | `43.02% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `99.34% <100%> (ø)` | :arrow_up: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/24651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.98% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=footer). Last update [88ca968...ef62b8f](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=h1) Report
> Merging [#24651](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/88ca968ff95583678f257bcad08c821e9f0f82c7?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24651/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24651      +/-   ##
==========================================
+ Coverage   92.37%   92.37%   +<.01%     
==========================================
  Files         166      166              
  Lines       52384    52386       +2     
==========================================
+ Hits        48390    48393       +3     
+ Misses       3994     3993       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.8% <100%> (ø)` | :arrow_up: |
| #single | `43.01% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `99.34% <100%> (ø)` | :arrow_up: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/24651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.98% <100%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24651/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.09% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=footer). Last update [88ca968...2b0e24e](https://codecov.io/gh/pandas-dev/pandas/pull/24651?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks @simonjayhawkins