-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maint: add the html formatter (#247)
Co-authored-by: Maxime Rey <[email protected]>
- Loading branch information
1 parent
b0cda21
commit f291ed5
Showing
8 changed files
with
165 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
{% block content %}<h1>Page Not Found</h1> | ||
<p>Sorry, we couldn't find that page. Error code 404. </p> | ||
<p>You can try using the search box above or check our menu on the left hand side of this page.</p> | ||
<p>If neither of those options work, please create a Github issue ticket in <a href="{{issue_page}}">{{project_name}}.</a></p> | ||
<p>Or try sending a mail to <a href="mailto:{{mail_id}}">{{team_name}}</a></p>.{% endblock %} | ||
{% block content %} | ||
<h1>Page Not Found</h1> | ||
<p>Sorry, we couldn't find that page. Error code 404.</p> | ||
<p> | ||
You can try using the search box above or check our menu on the left hand side | ||
of this page. | ||
</p> | ||
<p> | ||
If neither of those options work, please create a GitHub issue ticket in | ||
<a href="{{issue_page}}">{{project_name}}.</a> | ||
</p> | ||
<p>Or try sending a mail to <a href="mailto:{{mail_id}}">{{team_name}}</a></p> | ||
.{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/breadcrumbs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
<div class="container-xl"> | ||
<div class="row"> | ||
<div class="col-12 col-md-3" id="breadcrumbs-spacer"></div> | ||
<div class="col-12 col-md-11 col-xl-9" id="breadcrumbs"> | ||
{{ relbar() }} | ||
</div> | ||
<div class="row"> | ||
<div class="col-12 col-md-3" id="breadcrumbs-spacer"></div> | ||
<div class="col-12 col-md-11 col-xl-9" id="breadcrumbs">{{ relbar() }}</div> | ||
</div> | ||
</div> | ||
</div> |
95 changes: 51 additions & 44 deletions
95
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,60 @@ | ||
<!-- Debugging: html_theme_options = {{ html_theme_options }} --> | ||
{% if theme_use_meilisearch %} | ||
{% set API_KEY = theme_use_meilisearch.api_key %} | ||
<!-- Include the MeiliSearch CSS stylesheet only if theme present --> | ||
<link href="{{ pathto('_static/css/meilisearch.css', 1) }}" rel="stylesheet"> | ||
{% if theme_use_meilisearch %} {% set API_KEY = theme_use_meilisearch.api_key %} | ||
<!-- Include the MeiliSearch CSS stylesheet only if theme present --> | ||
<link href="{{ pathto('_static/css/meilisearch.css', 1) }}" rel="stylesheet" /> | ||
|
||
<!-- Create a search bar form with a text input and a dropdown selector for the search index --> | ||
<form class="bd-search d-flex align-items-center" action="{{ pathto('search') }}" method="get"> | ||
<input type="search" placeholder="Search" class="form-control" id="search-bar-input" autofocus /> | ||
<!-- Create a search bar form with a text input and a dropdown selector for the search index --> | ||
<form | ||
class="bd-search d-flex align-items-center" | ||
action="{{ pathto('search') }}" | ||
method="get" | ||
> | ||
<input | ||
type="search" | ||
placeholder="Search" | ||
class="form-control" | ||
id="search-bar-input" | ||
autofocus | ||
/> | ||
|
||
{% if theme_use_meilisearch.index_uids %} | ||
<select id="indexUidSelector" class="index-select"> | ||
{% for index_uid, index_name in theme_use_meilisearch.index_uids.items() %} | ||
<option value="{{ index_uid }}">{{ index_name }}</option> | ||
{% endfor %} | ||
</select> | ||
{% endif %} | ||
<i class="fa-solid fa-magnifying-glass"></i> | ||
<!-- Include the MeiliSearch JavaScript library for the search bar --> | ||
<script src="https://cdn.jsdelivr.net/npm/docs-searchbar.js@latest/dist/cdn/docs-searchbar.min.js"></script> | ||
{% if theme_use_meilisearch.index_uids %} | ||
<select id="indexUidSelector" class="index-select"> | ||
{% for index_uid, index_name in theme_use_meilisearch.index_uids.items() %} | ||
<option value="{{ index_uid }}">{{ index_name }}</option> | ||
{% endfor %} | ||
</select> | ||
{% endif %} | ||
<i class="fa-solid fa-magnifying-glass"></i> | ||
<!-- Include the MeiliSearch JavaScript library for the search bar --> | ||
<script src="https://cdn.jsdelivr.net/npm/docs-searchbar.js@latest/dist/cdn/docs-searchbar.min.js"></script> | ||
|
||
{% if not theme_use_meilisearch.host %} | ||
{% set HOST_URL = "https://backend.search.pyansys.com/" %} | ||
{% else %} | ||
{% set HOST_URL = theme_use_meilisearch.host %} | ||
{% endif %} | ||
|
||
<script> | ||
// Initialize the MeiliSearch bar with the given API key and host | ||
// inspect the first value of index UID as default | ||
var theSearchBar = docsSearchBar({ | ||
hostUrl: "{{ HOST_URL }}", | ||
apiKey: "{{ API_KEY }}", | ||
indexUid: "{{ theme_use_meilisearch.index_uids.items()|first|first }}", | ||
inputSelector: '#search-bar-input', | ||
enableDarkMode: 'auto', | ||
debug: true // Set debug to true if you want to inspect the dropdown | ||
}); | ||
{% if not theme_use_meilisearch.host %} {% set HOST_URL = | ||
"https://backend.search.pyansys.com/" %} {% else %} {% set HOST_URL = | ||
theme_use_meilisearch.host %} {% endif %} | ||
|
||
<script> | ||
// Initialize the MeiliSearch bar with the given API key and host | ||
// inspect the first value of index UID as default | ||
var theSearchBar = docsSearchBar({ | ||
hostUrl: "{{ HOST_URL }}", | ||
apiKey: "{{ API_KEY }}", | ||
indexUid: "{{ theme_use_meilisearch.index_uids.items()|first|first }}", | ||
inputSelector: "#search-bar-input", | ||
enableDarkMode: "auto", | ||
debug: true, // Set debug to true if you want to inspect the dropdown | ||
}); | ||
|
||
document.getElementById('indexUidSelector').addEventListener('change', function() { | ||
document | ||
.getElementById("indexUidSelector") | ||
.addEventListener("change", function () { | ||
theSearchBar.indexUid = this.value; | ||
theSearchBar.inputSelector = '#search-bar-input'; | ||
theSearchBar.inputSelector = "#search-bar-input"; | ||
}); | ||
|
||
// Set the focus on the search bar input | ||
document.getElementById('search-bar-input').focus(); | ||
</script> | ||
</form> | ||
// Set the focus on the search bar input | ||
document.getElementById("search-bar-input").focus(); | ||
</script> | ||
</form> | ||
{% else %} | ||
<!-- If there is no MiliSearch enabled, use the PyData search --> | ||
{%- include "pydata_sphinx_theme/components/search-field.html" -%} | ||
{% endif %} | ||
|
||
<!-- If there is no MiliSearch enabled, use the PyData search --> | ||
{%- include "pydata_sphinx_theme/components/search-field.html" -%} {% endif %} |
14 changes: 9 additions & 5 deletions
14
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
<p class="theme-version"> | ||
{% trans theme_version=ansys_sphinx_theme_version|e %}Built with the <a href="https://sphinxdocs.ansys.com/version/stable/index.html">Ansys Sphinx Theme</a> {{ ansys_sphinx_theme_version }}.{% endtrans %} | ||
<br>Last updated on <span id="date"></span></br> | ||
{% trans theme_version=ansys_sphinx_theme_version|e %}Built with the | ||
<a href="https://sphinxdocs.ansys.com/version/stable/index.html" | ||
>Ansys Sphinx Theme</a | ||
> | ||
{{ ansys_sphinx_theme_version }}.{% endtrans %} <br />Last updated on | ||
<span id="date"></span> | ||
</p> | ||
<script> | ||
var options = { day: 'numeric', month: 'long', year: 'numeric' }; | ||
var options = { day: "numeric", month: "long", year: "numeric" }; | ||
var lastModifiedDate = new Date(document.lastModified); | ||
var date = lastModifiedDate.toLocaleDateString('en-US', options); | ||
var date = lastModifiedDate.toLocaleDateString("en-US", options); | ||
document.getElementById("date").innerHTML = date; | ||
</script> | ||
</script> |
58 changes: 21 additions & 37 deletions
58
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/layout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,21 @@ | ||
{%- extends "pydata_sphinx_theme/layout.html" -%} | ||
|
||
{# Append our custom CSS after the bootstrap stylesheet so we can override where necessary #} | ||
{%- block css %} | ||
{{ super() }} | ||
{% if theme_show_breadcrumbs %} | ||
<link href="{{ pathto('_static/css/breadcrumbs.css', 1) }}" rel="stylesheet"> | ||
{% endif %} | ||
{%- endblock %} | ||
|
||
{% if not theme_show_prev_next %} | ||
{% set rellinks = [] %} | ||
{% endif %} | ||
|
||
{% set reldelim1 = ' » ' %} | ||
|
||
{# The list of breadcrumbs is defined as a <ul/>, below we add additional root items #} | ||
{% block rootrellink %} | ||
{% for (name, href) in theme_additional_breadcrumbs %} | ||
<li class="nav-item nav-item-additional-breadcrumb"><a href="{{ href }}">{{ name }}</a>{{ reldelim1 }}</li> | ||
{% endfor %} | ||
{% if pagename != 'index' %} | ||
<li class="nav-item nav-item-0"><a href="{{ pathto(root_doc) }}">{{ shorttitle }}</a>{{ reldelim1 }}</li> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block docs_navbar %} | ||
{{ super() }} | ||
|
||
{% if theme_switcher %} | ||
{% include 'components/announcement_version.html' %} | ||
{% endif %} | ||
|
||
{% if theme_show_breadcrumbs %} | ||
{% include 'components/breadcrumbs.html' %} | ||
{% endif %} | ||
{% endblock %} | ||
{%- extends "pydata_sphinx_theme/layout.html" -%} {# Append our custom CSS after | ||
the bootstrap stylesheet so we can override where necessary #} {%- block css %} | ||
{{ super() }} {% if theme_show_breadcrumbs %} | ||
<link href="{{ pathto('_static/css/breadcrumbs.css', 1) }}" rel="stylesheet" /> | ||
{% endif %} {%- endblock %} {% if not theme_show_prev_next %} {% set rellinks = | ||
[] %} {% endif %} {% set reldelim1 = ' » ' %} {# The list of breadcrumbs is | ||
defined as a | ||
<ul /> | ||
, below we add additional root items #} {% block rootrellink %} {% for (name, | ||
href) in theme_additional_breadcrumbs %} | ||
<li class="nav-item nav-item-additional-breadcrumb"> | ||
<a href="{{ href }}">{{ name }}</a>{{ reldelim1 }} | ||
</li> | ||
{% endfor %} {% if pagename != 'index' %} | ||
<li class="nav-item nav-item-0"> | ||
<a href="{{ pathto(root_doc) }}">{{ shorttitle }}</a>{{ reldelim1 }} | ||
</li> | ||
{% endif %} {% endblock %} {% block docs_navbar %} {{ super() }} {% if | ||
theme_switcher %} {% include 'components/announcement_version.html' %} {% endif | ||
%} {% if theme_show_breadcrumbs %} {% include 'components/breadcrumbs.html' %} | ||
{% endif %} {% endblock %} |
132 changes: 63 additions & 69 deletions
132
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/search.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,66 @@ | ||
{% if theme_use_meilisearch %} | ||
{%- extends "page.html" %} | ||
{%- block content %} | ||
{# checkbox to toggle primary sidebar #} | ||
<input type="checkbox" | ||
class="sidebar-toggle" | ||
name="__primary" | ||
id="__primary"/> | ||
<label class="overlay overlay-primary" for="__primary"></label> | ||
{# Checkboxes to toggle the secondary sidebar #} | ||
<input type="checkbox" | ||
class="sidebar-toggle" | ||
name="__secondary" | ||
id="__secondary"/> | ||
<label class="overlay overlay-secondary" for="__secondary"></label> | ||
{%- if theme_announcement -%} | ||
{% include "sections/announcement.html" %} | ||
{%- endif %} | ||
{% block docs_navbar %} | ||
<nav class="bd-header navbar navbar-expand-lg bd-navbar"> | ||
{%- include "sections/header.html" %} | ||
</nav> | ||
{% endblock docs_navbar %} | ||
<div class="bd-container"> | ||
<div class="bd-container__inner bd-page-width"> | ||
{# Primary sidebar #} | ||
<div class="bd-sidebar-primary bd-sidebar{% if not sidebars %} hide-on-wide{% endif %}"> | ||
{% include "sections/sidebar-primary.html" %} | ||
</div> | ||
{# Using an ID here so that the skip-link works #} | ||
<main id="main-content" class="bd-main"> | ||
{# Main content area #} | ||
{% block docs_main %} | ||
<div class="bd-content"> | ||
<div class="bd-article-container"> | ||
{# Article header #} | ||
<div class="bd-header-article">{% include "sections/header-article.html" %}</div> | ||
{# Article content #} | ||
{% block docs_body %} | ||
<div class="bd-search-container"> | ||
<h1>{{ _("Search") }}</h1> | ||
{% include "components/search-field.html" %} | ||
</div> | ||
{% endblock docs_body %} | ||
{# Article Footer #} | ||
{% if theme_show_prev_next %} | ||
<footer class="bd-footer-article"> | ||
{% include "sections/footer-article.html" %} | ||
</footer> | ||
{% endif %} | ||
</div> | ||
{# Secondary sidebar #} | ||
{% block docs_toc %} | ||
{% if not remove_sidebar_secondary %} | ||
<div class="bd-sidebar-secondary bd-toc">{% include "sections/sidebar-secondary.html" %}</div> | ||
{% endif %} | ||
{% endblock docs_toc %} | ||
{% if theme_use_meilisearch %} {%- extends "page.html" %} {%- block content %} | ||
{# checkbox to toggle primary sidebar #} | ||
<input type="checkbox" class="sidebar-toggle" name="__primary" id="__primary" /> | ||
<label class="overlay overlay-primary" for="__primary"></label> | ||
{# Checkboxes to toggle the secondary sidebar #} | ||
<input | ||
type="checkbox" | ||
class="sidebar-toggle" | ||
name="__secondary" | ||
id="__secondary" | ||
/> | ||
<label class="overlay overlay-secondary" for="__secondary"></label> | ||
{%- if theme_announcement -%} {% include "sections/announcement.html" %} {%- | ||
endif %} {% block docs_navbar %} | ||
<nav class="bd-header navbar navbar-expand-lg bd-navbar"> | ||
{%- include "sections/header.html" %} | ||
</nav> | ||
{% endblock docs_navbar %} | ||
<div class="bd-container"> | ||
<div class="bd-container__inner bd-page-width"> | ||
{# Primary sidebar #} | ||
<div | ||
class="bd-sidebar-primary bd-sidebar{% if not sidebars %} hide-on-wide{% endif %}" | ||
> | ||
{% include "sections/sidebar-primary.html" %} | ||
</div> | ||
{# Using an ID here so that the skip-link works #} | ||
<main id="main-content" class="bd-main"> | ||
{# Main content area #} {% block docs_main %} | ||
<div class="bd-content"> | ||
<div class="bd-article-container"> | ||
{# Article header #} | ||
<div class="bd-header-article"> | ||
{% include "sections/header-article.html" %} | ||
</div> | ||
{# Article content #} {% block docs_body %} | ||
<div class="bd-search-container"> | ||
<h1>{{ _("Search") }}</h1> | ||
{% include "components/search-field.html" %} | ||
</div> | ||
<footer class="bd-footer-content"> | ||
{% include "sections/footer-content.html" %} | ||
{% endblock docs_body %} {# Article Footer #} {% if | ||
theme_show_prev_next %} | ||
<footer class="bd-footer-article"> | ||
{% include "sections/footer-article.html" %} | ||
</footer> | ||
{% endblock docs_main %} | ||
</main> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{# Secondary sidebar #} {% block docs_toc %} {% if not | ||
remove_sidebar_secondary %} | ||
<div class="bd-sidebar-secondary bd-toc"> | ||
{% include "sections/sidebar-secondary.html" %} | ||
</div> | ||
{% endif %} {% endblock docs_toc %} | ||
</div> | ||
<footer class="bd-footer-content"> | ||
{% include "sections/footer-content.html" %} | ||
</footer> | ||
{% endblock docs_main %} | ||
</main> | ||
</div> | ||
{# Scripts placed at the end of the page to cut down on time to first content #} | ||
{%- block scripts_end %}{{ _webpack.body_post() }}{%- endblock scripts_end %} | ||
{%- endblock content %} | ||
{% else %} | ||
<!-- If there is no MeiliSearch enabled, use the PyData search --> | ||
{%- include "pydata_sphinx_theme/search.html" -%} | ||
{% endif %} | ||
</div> | ||
{# Scripts placed at the end of the page to cut down on time to first content #} | ||
{%- block scripts_end %}{{ _webpack.body_post() }}{%- endblock scripts_end %} | ||
{%- endblock content %} {% else %} | ||
<!-- If there is no MeiliSearch enabled, use the PyData search --> | ||
{%- include "pydata_sphinx_theme/search.html" -%} {% endif %} |