diff options
author | dweller <dweller@cabin.digital> | 2024-03-08 19:53:47 +0200 |
---|---|---|
committer | dweller <dweller@cabin.digital> | 2024-03-08 19:53:47 +0200 |
commit | d66f88febd3f19afd6b0ed0bee347e8f7db3e086 (patch) | |
tree | 0a931a777591fa6d4edaaeccefa27e4d2d75d090 /search.php | |
parent | 12da9560c792ae5f3beb31dfdf5f41d70d03e4ab (diff) |
fix formatting and parsing when using self-compiled mandoc that produced different HTML output
Diffstat (limited to 'search.php')
-rw-r--r-- | search.php | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -48,8 +48,8 @@ <nav id="search_pane"> <form> <div id="query_wrap"> - <input id="query" type='searcg' value='<?=$query;?>' name='query' autocorrect="off" autocapitalize="none" required/> - <button id="def" type='submit' value='man' name='action' class="btn-def" aria-hidden="true" tabindex="-1"></button> + <input id="query" type='searcg' value='<?=$query;?>' name='query' autocorrect="off" autocapitalize="none" required/> + <button id="btn_def" type='submit' value='man' name='action' class="btn-def" aria-hidden="true" tabindex="-1"></button> <input type="checkbox" id="query_opts_toggle"/> <div id="query_opts"> <span class="query_opt" title="section">-s</span> @@ -79,8 +79,8 @@ ?> </select> </div> - <button id="mank" type='submit' value='apropos' name='action' title="apropos(1)">-k</button> - <button id="man" type='submit' value='man' name='action' title="Feeling lucky, punk?" class="btn-acc"> + <button id="btn_mank" type='submit' value='apropos' name='action' title="apropos(1)">-k</button> + <button id="btn_man" type='submit' value='man' name='action' title="Feeling lucky, punk?" class="btn-acc"> <div id="query_icon"></div> </button> </div> @@ -103,13 +103,13 @@ $found_man = false; if($action === "man") { - $res = exec("man -M $manpath -T html -O fragment,toc $arg_section " + $res = exec("$manbin -M $manpath -T html -O fragment,toc $arg_section " . escapeshellarg($query), $lines, $ret); if($ret === 0) { /* TODO: maybe hardcoding a line isn't such a good idea, but I don't wanna regex the * whole thing */ - preg_match('/\<td.*\>.+\((.+)\)\<\/td>/iu', $lines[4], $sect); + preg_match('/.+<span class="head-ltitle">.+\((.).*\)<\/span>/iu', $lines[1], $sect); $url = "$root/?query=". urlencode($query) ."&section=". urlencode($sect[1]) ."&arch=". urlencode($arch) ."&action=lmmtfy"; @@ -139,7 +139,7 @@ if(($action === "apropos") || !$found_man) { - $res = exec("man -M $manpath $arg_section -k " . escapeshellarg($query), $lines, $ret); + $res = exec("$manbin -M $manpath $arg_section -k " . escapeshellarg($query), $lines, $ret); if($ret === 0) { $n = count($lines); |