update
This commit is contained in:
@@ -171,11 +171,27 @@ class ManPageConverter:
|
|||||||
Returns:
|
Returns:
|
||||||
Cleaned HTML
|
Cleaned HTML
|
||||||
"""
|
"""
|
||||||
|
# Fix empty header cells
|
||||||
html = re.sub(
|
html = re.sub(
|
||||||
r'<td class="head-(ltitle|rtitle)">\(\)</td>',
|
r'<td class="head-(ltitle|rtitle)">\(\)</td>',
|
||||||
r'<td class="head-\1"></td>',
|
r'<td class="head-\1"></td>',
|
||||||
html,
|
html,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Remove empty <p class="Pp"></p> tags (from .sp directives in troff)
|
||||||
|
html = re.sub(r'<p class="Pp">\s*</p>', '', html)
|
||||||
|
|
||||||
|
# Clean up trailing whitespace and br tags in pre blocks
|
||||||
|
# Match: <pre>...</pre> and clean trailing <br/> followed by whitespace
|
||||||
|
def clean_pre_block(match):
|
||||||
|
content = match.group(1)
|
||||||
|
# Remove trailing <br/> tags and whitespace before closing </pre>
|
||||||
|
content = re.sub(r'<br\s*/>\s*$', '', content)
|
||||||
|
content = re.sub(r'\s+$', '', content)
|
||||||
|
return f'<pre>{content}</pre>'
|
||||||
|
|
||||||
|
html = re.sub(r'<pre>(.*?)</pre>', clean_pre_block, html, flags=re.DOTALL)
|
||||||
|
|
||||||
html = html.strip()
|
html = html.strip()
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|||||||
Reference in New Issue
Block a user