chiark / gitweb /
doxygen: make it possible to search directly from browser URL bar.
authorVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 13:11:30 +0000 (14:11 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 21:07:36 +0000 (22:07 +0100)
commit9362d22c9505cc3045df4c7f7ac9647f9d90e5dc
tree92025c9c9cfc79d0951a95372dc1f844bec4f7b3
parent52f9b65f9ad3565d8fa7724bd0e3be041bb4e4b6
doxygen: make it possible to search directly from browser URL bar.

Adds an ability to specify search query by adding ?q={query}#search
to URL, which can be then bookmarked in the browsers to provide search
directly from the URL bar (or search input field).

On browsers supporting OpenSearch discovery (Firefox, Chrome, probably
Edge too), it also provides metadata that allow "single-click" addition
of the search engine to browser's search engine list. This option is
unfortunately well-hidden in the current versions (Firefox has it in the
three-dots menu, in Chrome you need to go to Settings while being on
this page and then it shows a suggestion, wtf). The OpenSearch metadata
are provided through a new opensearch.xml file and referenced from page
<head>. OpenSearch also supports autocompletion and search directly from
browser address bar, but for that to work I would need to implement a
server-side search functionality. Not yet, since I don't have any
immediate plans to turn my cloud file-serving Apache installation into a
smart and vulnerable attack target.

This also wraps the input in a <form>, so browsers not supporting
OpenSearch discovery (Vivaldi) can still add the search engine by
right-clicking on the input field. This works in Firefox as well.
Also, because of the <form> added, Vivaldi started autocompleting crap
suggestions for me, so I had to explicitly disable that.
15 files changed:
doc/doxygen.rst
doxygen/dox2html5.py
doxygen/search.js
doxygen/templates/base.html
doxygen/templates/opensearch.xml [new file with mode: 0644]
doxygen/test/layout/pages.html
doxygen/test/layout_generated_doxyfile/index.html
doxygen/test/layout_minimal/index.html
doxygen/test/layout_search_binary/index.html
doxygen/test/layout_search_opensearch/Doxyfile [new file with mode: 0644]
doxygen/test/layout_search_opensearch/index.html [new file with mode: 0644]
doxygen/test/layout_search_opensearch/indexpage.xml [new file with mode: 0644]
doxygen/test/layout_search_opensearch/opensearch.xml.html [new file with mode: 0644]
doxygen/test/test_doxyfile.py
doxygen/test/test_layout.py