forked from docs/doc-exports
fixing th condition and adding one more unit test
This commit is contained in:
parent
efab231e2b
commit
ecc478cd31
@ -224,7 +224,7 @@ class OTCDocConvertor:
|
||||
|
||||
# Drop strong in table headers "/"
|
||||
for th in soup.body.find_all("th"):
|
||||
if th and th.p.strong:
|
||||
if th.p and th.p.strong:
|
||||
th.p.strong.unwrap()
|
||||
|
||||
if args and args.improve_table_headers:
|
||||
|
@ -233,3 +233,17 @@ class TestConvertor(TestCase):
|
||||
str(res.find('th')),
|
||||
expected.strip(),
|
||||
)
|
||||
|
||||
def test_streamline_html_escape_17(self):
|
||||
test_data= """
|
||||
<th align="left" class="cellrowborder" id="mcps1.3.2.3.2.5.1.2" valign="top" width="20%">Mandatory</th>
|
||||
""" # noqa
|
||||
expected = """
|
||||
<th align="left" class="cellrowborder" id="mcps1.3.2.3.2.5.1.2" valign="top" width="20%">Mandatory</th>
|
||||
""" # noqa
|
||||
soup = bs4.BeautifulSoup(test_data, 'lxml')
|
||||
res = self.convertor.streamline_html(soup, "dummy")
|
||||
self.assertEqual(
|
||||
str(res.find('th')),
|
||||
expected.strip(),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user