Compare commits

...

1 Commits

Author SHA1 Message Date
088d6a6daf Add unittests for conversion
add first tests for checking escaping of weird asterisks
2023-03-21 19:37:33 +01:00
6 changed files with 174 additions and 3 deletions

2
.gitignore vendored
View File

@ -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
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./otc_doc_convertor/tests/unit
top_dir=./

View File

@ -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")

View File

File diff suppressed because it is too large Load Diff

View File

@ -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