From 36d138c406e0e8974da979f9af2414b1f99b3131 Mon Sep 17 00:00:00 2001 From: dweller Date: Mon, 26 Feb 2024 14:04:19 +0200 Subject: attempt to fix mandoc retarded CSS generation --- search.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'search.php') diff --git a/search.php b/search.php index af2c398..95d8254 100644 --- a/search.php +++ b/search.php @@ -69,17 +69,29 @@ if(!empty($section)) $arg_section = "-s ". escapeshellarg($section); - $res = exec("man -M $manpath -T html -O fragment $arg_section " + $res = exec("man -M $manpath -T html -O fragment,toc $arg_section " . escapeshellarg($query), $lines, $ret); if($ret === 0) { $url = "$root/?query=". urlencode($query) ."&section=1&action=lmmtfy"; + /* HACK: fucking mandoc just generates tons of useless
s that make stuff + * look horrible. So I just remove it here. + * As you can see, they also decided to pepper the HTML with inline style coz they + * just absolutely hate me, so I strip it too. + */ + for($i = 0; $i < count($lines); $i++) + { + $line = preg_replace('/\/i', '', $lines[$i]); + $line = preg_replace('/style=".*"/i', '', $line); + if(!empty(trim($line))) $lines2[$i] = $line; + } + echo "