forked from docs/doc-exports
improving the conversion based on A.G. feedback
This commit is contained in:
@ -439,17 +439,17 @@ class OTCDocConvertor:
|
||||
|
||||
# Special case for multiple asterisks and colons like ecs:*:*
|
||||
re_escape = re.compile(r"([:])(\*+)")
|
||||
re_escape_new = re.compile(r"([:])(\*)[^$]")
|
||||
for p in soup.body.find_all(string=re_escape):
|
||||
if p.string and (p.parent.name == "p" or p.parent.name == "li"):
|
||||
p.string.replace_with(
|
||||
re.sub(re_escape, r"\1``\2``", p.string))
|
||||
string=p.string
|
||||
while re.search(re_escape, string):
|
||||
if re.search(re_escape_new, string):
|
||||
string=re.sub(re_escape, r"\1``\2``", string, count=1)
|
||||
else:
|
||||
p.string.replace_with(string)
|
||||
break
|
||||
|
||||
# Additional loop fixing false positives from previous loop
|
||||
re_escape = re.compile(r":``\*``$")
|
||||
for p in soup.body.find_all(string=re_escape):
|
||||
if p.string and (p.parent.name == "p" or p.parent.name == "li"):
|
||||
p.string.replace_with(
|
||||
re.sub(re_escape, r":*", p.string))
|
||||
|
||||
# Drop parent link at the bottom of the page
|
||||
for parent in soup.body.find_all("p", class_="familylinks"):
|
||||
|
||||
Reference in New Issue
Block a user