forked from docs/doc-exports
Compare commits
2 Commits
main
...
convertor_
Author | SHA1 | Date | |
---|---|---|---|
ecc478cd31 | |||
efab231e2b |
@ -224,7 +224,7 @@ class OTCDocConvertor:
|
||||
|
||||
# Drop strong in table headers "/"
|
||||
for th in soup.body.find_all("th"):
|
||||
if th.p.strong:
|
||||
if th.p and th.p.strong:
|
||||
th.p.strong.unwrap()
|
||||
|
||||
if args and args.improve_table_headers:
|
||||
|
@ -219,3 +219,31 @@ class TestConvertor(TestCase):
|
||||
str(res.find('p')),
|
||||
expected.strip(),
|
||||
)
|
||||
|
||||
def test_streamline_html_escape_16(self):
|
||||
test_data= """
|
||||
<th align="left" class="cellrowborder" id="mcps1.3.2.3.2.5.1.2" valign="top" width="20%"><p><strong>Mandatory</strong></p></th>
|
||||
""" # noqa
|
||||
expected = """
|
||||
<th align="left" class="cellrowborder" id="mcps1.3.2.3.2.5.1.2" valign="top" width="20%"><p>Mandatory</p></th>
|
||||
""" # noqa
|
||||
soup = bs4.BeautifulSoup(test_data, 'lxml')
|
||||
res = self.convertor.streamline_html(soup, "dummy")
|
||||
self.assertEqual(
|
||||
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