forked from docs/doc-exports
Add unittests for conversion
add first tests for checking escaping of weird asterisks
This commit is contained in:
parent
eda19245f1
commit
088d6a6daf
2
.gitignore
vendored
2
.gitignore
vendored
@ -134,6 +134,8 @@ dmypy.json
|
|||||||
**/temp/
|
**/temp/
|
||||||
**/tmp_result/
|
**/tmp_result/
|
||||||
|
|
||||||
|
.stestr/
|
||||||
|
|
||||||
# Some people build submodule because of not understanding git basics
|
# Some people build submodule because of not understanding git basics
|
||||||
doc-exports
|
doc-exports
|
||||||
|
|
||||||
|
3
.stestr.conf
Normal file
3
.stestr.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
test_path=./otc_doc_convertor/tests/unit
|
||||||
|
top_dir=./
|
@ -109,7 +109,7 @@ class OTCDocConvertor:
|
|||||||
"Cannot find string for rawization anymore"
|
"Cannot find string for rawization anymore"
|
||||||
)
|
)
|
||||||
|
|
||||||
def streamline_html(self, soup, file_name):
|
def streamline_html(self, soup, file_name, args=None):
|
||||||
# Drop eventual header duplicated anchors
|
# Drop eventual header duplicated anchors
|
||||||
fname = file_name.replace(".html", "").lower()
|
fname = file_name.replace(".html", "").lower()
|
||||||
page_anchors = set()
|
page_anchors = set()
|
||||||
@ -227,7 +227,7 @@ class OTCDocConvertor:
|
|||||||
if th.p.strong:
|
if th.p.strong:
|
||||||
th.p.strong.unwrap()
|
th.p.strong.unwrap()
|
||||||
|
|
||||||
if self.args.improve_table_headers:
|
if args and args.improve_table_headers:
|
||||||
# Add spaces around "/"
|
# Add spaces around "/"
|
||||||
for th in soup.body.find_all("th"):
|
for th in soup.body.find_all("th"):
|
||||||
if hasattr(th, "p") and th.p.string:
|
if hasattr(th, "p") and th.p.string:
|
||||||
@ -562,7 +562,7 @@ class OTCDocConvertor:
|
|||||||
content = re.sub(r"≤", "<=", content)
|
content = re.sub(r"≤", "<=", content)
|
||||||
content = re.sub(r"≥", ">=", content)
|
content = re.sub(r"≥", ">=", content)
|
||||||
soup = bs4.BeautifulSoup(content, "lxml")
|
soup = bs4.BeautifulSoup(content, "lxml")
|
||||||
proc = self.streamline_html(soup, f.name)
|
proc = self.streamline_html(soup, f.name, self.args)
|
||||||
|
|
||||||
for lnk in proc.find_all("a"):
|
for lnk in proc.find_all("a"):
|
||||||
href = lnk.get("href")
|
href = lnk.get("href")
|
||||||
|
0
otc_doc_convertor/tests/unit/__init__.py
Normal file
0
otc_doc_convertor/tests/unit/__init__.py
Normal file
165
otc_doc_convertor/tests/unit/test_convertor.py
Normal file
165
otc_doc_convertor/tests/unit/test_convertor.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -222,6 +222,7 @@
|
|||||||
propose_change_git_baseurl: "gitea.eco.tsi-dev.otc-service.com"
|
propose_change_git_baseurl: "gitea.eco.tsi-dev.otc-service.com"
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
|
- otc-tox-py39
|
||||||
- otc-tox-pep8:
|
- otc-tox-pep8:
|
||||||
nodeset: ubuntu-focal
|
nodeset: ubuntu-focal
|
||||||
- otc-doc-exports-convert-application
|
- otc-doc-exports-convert-application
|
||||||
|
Loading…
x
Reference in New Issue
Block a user