git: 645b00391a - main - Firefox opensearch autocomplete workaround

From: Wolfram Schneider <wosch_at_FreeBSD.org>
Date: Sat, 07 Jan 2023 17:17:48 UTC
The branch main has been updated by wosch:

URL: https://cgit.FreeBSD.org/doc/commit/?id=645b00391a5374ea843b8066ce9d9f701b991b6f

commit 645b00391a5374ea843b8066ce9d9f701b991b6f
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2023-01-07 17:17:34 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2023-01-07 17:17:34 +0000

    Firefox opensearch autocomplete workaround
---
 website/content/en/cgi/man.cgi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/website/content/en/cgi/man.cgi b/website/content/en/cgi/man.cgi
index 7c5e8bffa9..1d9b116e3c 100755
--- a/website/content/en/cgi/man.cgi
+++ b/website/content/en/cgi/man.cgi
@@ -1193,6 +1193,14 @@ sub do_man {
     $form{'query'} =~ s/"//g;
     $form{'query'} =~ s/=//g;
 
+    # Firefox opensearch autocomplete workaround
+    if ($form{'sourceid'} eq 'opensearch') {
+        # remove space between double colon
+        $form{'query'} =~ s/: :/::/g;
+        # remove space before a dot 
+        $form{'query'} =~ s/ \./\./g;
+    }
+
     $name = $query = $form{'query'};
     $section  = $form{'sektion'};
     $apropos  = $form{'apropos'};