Skip to content

Commit dff8aa3

Browse files
authored
Merge branch 'master' into fix/table-first-row
2 parents b685120 + 099c4b8 commit dff8aa3

File tree

10 files changed

+121
-47
lines changed

10 files changed

+121
-47
lines changed

.github/workflows/main.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the master branch
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
code-quality:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
toxenv:
20+
- black
21+
- flake8
22+
- mypy
23+
- isort
24+
env:
25+
TOXENV: ${{ matrix.toxenv }}
26+
27+
name: "Tox ${{ matrix.toxenv }}"
28+
steps:
29+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
- uses: actions/checkout@v2
31+
with:
32+
fetch-depth: 0
33+
34+
- name: setup python
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: '3.9'
38+
39+
- name: Install Requirements [${{ matrix.toxenv }}]
40+
run: pip install tox
41+
42+
- name: Tox-${{ matrix.toxenv }}
43+
run: tox
44+
# This workflow contains a single job called "build"
45+
test:
46+
# The type of runner that the job will run on
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
toxenv:
51+
- py38
52+
- py39
53+
- py310
54+
include:
55+
- toxenv: py38
56+
python-version: '3.8'
57+
- toxenv: py39
58+
python-version: '3.9'
59+
- toxenv: py310
60+
python-version: '3.10'
61+
- toxenv: py311
62+
python-version: '3.11'
63+
- toxenv: py312
64+
python-version: '3.12'
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
TOXENV: ${{ matrix.toxenv }}
68+
name: "Python ${{ matrix.python-version }} | Tox ${{ matrix.toxenv }}"
69+
70+
# Steps represent a sequence of tasks that will be executed as part of the job
71+
steps:
72+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
73+
- uses: actions/checkout@v2
74+
with:
75+
fetch-depth: 2
76+
77+
- name: setup python
78+
uses: actions/setup-python@v2
79+
with:
80+
python-version: ${{ matrix.python-version }}
81+
82+
- name: Install Requirements [Python-${{ matrix.python-version }}]
83+
run: pip install tox
84+
85+
- name: Tox-${{ matrix.toxenv }}
86+
run: tox
87+
88+
- name: Upload coverage to Codecov
89+
# see https://github.com/codecov/codecov-action/blob/master/README.md
90+
uses: codecov/codecov-action@v2
91+
with:
92+
flags: unittests-${{ matrix.python-version }}
93+
fail_ci_if_error: true # default = false
94+
os: toxenv
95+
verbose: true # default = false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dist
66
.idea
77
.coverage
88
.coverage.*
9+
coverage.xml
910
env/
1011
.c9/
1112
.vscode

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

ChangeLog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ UNRELEASED
99
* Fix #344: indent ``<ul>`` inside ``<ol>`` three spaces instead of two to comply with CommonMark, GFM, etc.
1010
* Fix #324: unnecessary spaces around ``<b>``, ``<em>``, and ``strike`` tags.
1111
* Don't wrap tables by default and add a ``--wrap-tables`` config option
12+
* Remove support for Python ≤ 3.5. Now requires Python 3.6+.
13+
* Support for Python 3.10.
1214
* Fix #320 padding empty tables and tables with no </tr> tags.
1315
* Add ``ignore_mailto_links`` config option to ignore ``mailto:`` style links.
1416

1517

18+
1619
2020.1.16
1720
=========
1821
----

html2text/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def feed(self, data: str) -> None:
142142
super().feed(data)
143143

144144
def handle(self, data: str) -> str:
145+
self.start = True
145146
self.feed(data)
146147
self.feed("")
147148
markdown = self.optwrap(self.finish())
@@ -372,9 +373,7 @@ def handle_tag(
372373
self.p()
373374

374375
if tag == "br" and start:
375-
if self.astack:
376-
self.space = True
377-
elif self.blockquote > 0:
376+
if self.blockquote > 0:
378377
self.o(" \n> ")
379378
else:
380379
self.o(" \n")

setup.cfg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ classifiers =
1717
Operating System :: OS Independent
1818
Programming Language :: Python
1919
Programming Language :: Python :: 3
20-
Programming Language :: Python :: 3.5
21-
Programming Language :: Python :: 3.6
2220
Programming Language :: Python :: 3.7
2321
Programming Language :: Python :: 3.8
2422
Programming Language :: Python :: 3.9
23+
Programming Language :: Python :: 3.10
2524
Programming Language :: Python :: 3 :: Only
2625
Programming Language :: Python :: Implementation :: CPython
2726
Programming Language :: Python :: Implementation :: PyPy
@@ -30,7 +29,7 @@ platform = OS Independent
3029
[options]
3130
zip_safe = False
3231
packages = html2text
33-
python_requires = >=3.5
32+
python_requires = >=3.7
3433

3534
[options.entry_points]
3635
console_scripts =
@@ -48,4 +47,4 @@ combine_as_imports = True
4847
profile = black
4948

5049
[mypy]
51-
python_version = 3.5
50+
python_version = 3.7

test/br_inside_a.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/br_inside_a.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import html2text
2+
3+
# See https://github.com/Alir3z4/html2text/issues/163 for more information.
4+
5+
6+
def test_newline_on_multiple_calls():
7+
h = html2text.HTML2Text()
8+
html = "<p>test</p>"
9+
md1 = h.handle(html)
10+
md2 = h.handle(html)
11+
md3 = h.handle(html)
12+
assert md1 == md2 == md3

tox.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ envlist =
44
flake8
55
isort
66
mypy
7-
py{35,36,37,38,py3}
8-
minversion = 1.9
7+
py{38,39,310,311,312}
8+
minversion = 3.24
99

1010
[testenv]
1111
commands =
12-
pytest --cov=html2text {posargs}
12+
pytest --cov=./ --cov-report=xml {posargs}
1313
deps =
1414
pytest
1515
pytest-cov
1616

1717
[testenv:black]
1818
basepython = python3
1919
commands =
20-
black --target-version py35 --check --diff .
20+
black --target-version py311 --check --diff .
2121
deps =
2222
black
2323
skip_install = true
@@ -35,7 +35,7 @@ basepython = python3
3535
commands =
3636
isort --check-only --diff .
3737
deps =
38-
isort >= 5.0.1
38+
isort >= 5.10.1
3939
skip_install = true
4040

4141
[testenv:mypy]

0 commit comments

Comments
 (0)