Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opensearch support #161

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions print_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ def write_html_files(partition, loc_map, notes, mod_docs, instances, tactic_docs
current_project = None
current_filename = None

with open_outfile('opensearch.xml') as out:
out.write(env.get_template('opensearch.xml.j2').render())

def write_site_map(partition):
with open_outfile('sitemap.txt') as out:
for filename in partition:
Expand Down
1 change: 1 addition & 0 deletions templates/base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<link rel="stylesheet" href="{{ site_root }}pygments.css">
<link rel="stylesheet" href="{{ site_root }}pygments-dark.css">
<link rel="shortcut icon" href="{{ site_root }}favicon.ico">
<link rel="search" type="application/opensearchdescription+xml" title="mathlib docs" href="{{ site_root }}opensearch.xml">
<title>{% block title %}{% endblock %} - mathlib docs</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down
8 changes: 8 additions & 0 deletions templates/opensearch.xml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>mathlib</ShortName>
<Description>Search mathlib docs</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">{{ site_root }}/static/favicon.ico</Image>
<Url type="text/html" method="GET" template="{{ site_root }}/find/{searchTerms}" />
</OpenSearchDescription>