From b2ce978f84503ef474ea8dd9d4db410f45a8866e Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Thu, 11 Dec 2025 13:22:59 -0600 Subject: [PATCH] update --- src/rocky_man/processor/converter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/rocky_man/processor/converter.py b/src/rocky_man/processor/converter.py index 6d82920..c868055 100644 --- a/src/rocky_man/processor/converter.py +++ b/src/rocky_man/processor/converter.py @@ -171,11 +171,27 @@ class ManPageConverter: Returns: Cleaned HTML """ + # Fix empty header cells html = re.sub( r'\(\)', r'', html, ) + + # Remove empty

tags (from .sp directives in troff) + html = re.sub(r'

\s*

', '', html) + + # Clean up trailing whitespace and br tags in pre blocks + # Match:
...
and clean trailing
followed by whitespace + def clean_pre_block(match): + content = match.group(1) + # Remove trailing
tags and whitespace before closing + content = re.sub(r'\s*$', '', content) + content = re.sub(r'\s+$', '', content) + return f'
{content}
' + + html = re.sub(r'
(.*?)
', clean_pre_block, html, flags=re.DOTALL) + html = html.strip() return html