-
Notifications
You must be signed in to change notification settings - Fork 8
feat: cleanup js
#798
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
Open
Revathyvenugopal162
wants to merge
12
commits into
main
Choose a base branch
from
feat/cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: cleanup js
#798
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c0a4d72
feat: cleanup js
Revathyvenugopal162 9f2d6aa
chore: adding changelog file 798.added.md [dependabot-skip]
pyansys-ci-bot b339cdf
fix: search.js file
Revathyvenugopal162 81add1f
fix: update the html
Revathyvenugopal162 0045e6e
Merge branch 'main' into feat/cleanup
Revathyvenugopal162 f6a1331
chore: adding changelog file 798.added.md [dependabot-skip]
pyansys-ci-bot 1fb2582
Merge branch 'main' into feat/cleanup
Revathyvenugopal162 603695b
Merge branch 'main' into feat/cleanup
Revathyvenugopal162 adf84f1
Merge branch 'main' into feat/cleanup
Revathyvenugopal162 1aa8cf9
fix: add the js error for announcement
Revathyvenugopal162 d49a00a
fix: add the js error for announcement
Revathyvenugopal162 57f19e3
Merge branch 'main' into feat/cleanup
Revathyvenugopal162 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Cleanup \`\`js\`\` |
28 changes: 23 additions & 5 deletions
28
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/announcement_version.html
This file contains hidden or 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,14 +1,32 @@ | ||
<div id="announcement_msg"></div> | ||
|
||
<!-- | ||
Announcement Version Loader | ||
Dynamically loads the announcement.html content into the announcement_msg div. | ||
--> | ||
<div id="announcement_msg" aria-live="polite"></div> | ||
<script> | ||
// Fetch and inject the announcement HTML content | ||
fetch("announcement.html") | ||
.then((response) => { | ||
if (response.status === 404) { | ||
// No announcement available, leave empty and do not log error | ||
return ""; | ||
} | ||
if (!response.ok) { | ||
throw new Error(`HTTP error: ${response.status}`); | ||
} | ||
return response.text(); | ||
}) | ||
.then( | ||
(text) => (document.getElementById("announcement_msg").innerHTML = text), | ||
) | ||
.catch((error) => console.error(`Fetch problem: ${error.message}`)); | ||
.then((text) => { | ||
var msgDiv = document.getElementById("announcement_msg"); | ||
if (msgDiv) { | ||
msgDiv.innerHTML = text; | ||
} | ||
}) | ||
.catch((error) => { | ||
// Log only unexpected fetch errors | ||
if (!(error.message && error.message.startsWith("HTTP error: 404"))) { | ||
console.error(`Fetch problem: ${error.message}`); | ||
} | ||
}); | ||
</script> |
20 changes: 13 additions & 7 deletions
20
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/cheatsheet_sidebar.html
This file contains hidden or 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,13 +1,19 @@ | ||
|
||
{# | ||
Cheatsheet Sidebar | ||
Displays a cheatsheet link and thumbnail in the sidebar if configured. | ||
Uses <div> for compatibility as requested. | ||
#} | ||
{% if theme_cheatsheet %} | ||
{% set theme_cheatsheet_title = theme_cheatsheet.get('title', 'Cheatsheet') %} | ||
<div class="sidebar-cheatsheets"> | ||
{% set theme_cheatsheet_output_dir = theme_cheatsheet.get('output_dir') %} | ||
{% set theme_cheatsheet_thumbnail = theme_cheatsheet.get('thumbnail') %} | ||
{% set theme_cheatsheet_output = pathto(theme_cheatsheet_output_dir, 1) %} | ||
{% set theme_cheatsheet_thumbnail = pathto(theme_cheatsheet_thumbnail, 1) %} | ||
<div class="sidebar-cheatsheets" aria-label="Cheatsheet"> | ||
<h4>{{ theme_cheatsheet_title }}</h4> | ||
{% set theme_cheatsheet_output_dir = theme_cheatsheet.get('output_dir') %} | ||
{% set theme_cheatsheet_thumbnail = theme_cheatsheet.get('thumbnail') %} | ||
{% set theme_cheatsheet_output = pathto(theme_cheatsheet_output_dir, 1) %} | ||
{% set theme_cheatsheet_thumbnail = pathto(theme_cheatsheet_thumbnail, 1) %} | ||
<a href="{{ theme_cheatsheet_output }}"> | ||
<img src="{{ theme_cheatsheet_thumbnail }}" alt="{{ theme_cheatsheet_title }}" /> | ||
<a href="{{ theme_cheatsheet_output }}" target="_blank" rel="noopener noreferrer"> | ||
<img src="{{ theme_cheatsheet_thumbnail }}" alt="{{ theme_cheatsheet_title }} thumbnail" loading="lazy" /> | ||
</a> | ||
</div> | ||
{% endif %} |
36 changes: 23 additions & 13 deletions
36
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/edit-this-page.html
This file contains hidden or 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,15 +1,25 @@ | ||
{% if sourcename is defined and theme_use_edit_page_button==true and | ||
page_source_suffix %} {% set src = sourcename.split('.') %} | ||
<div class="tocsection editthispage"> | ||
<a href="{{ fix_edit_link_page(get_edit_provider_and_url()[1]) }}"> | ||
<i class="fa-solid fa-pencil"></i> | ||
{% set provider = get_edit_provider_and_url()[0] %} {% block | ||
edit_this_page_text %} {% if provider %} {% trans provider=provider %}Edit | ||
on {{ provider }}{% endtrans %} {% else %} {% trans %}Edit{% endtrans %} {% | ||
endif %} {% endblock %} | ||
</a> | ||
</div> | ||
|
||
{# | ||
Edit This Page Button | ||
Shows a button to edit the current page on the documentation's source provider. | ||
Falls back to the PyData theme's button if not available. | ||
#} | ||
{% if sourcename is defined and theme_use_edit_page_button==true and page_source_suffix %} | ||
{% set src = sourcename.split('.') %} | ||
<nav class="tocsection editthispage" aria-label="Edit this page"> | ||
<a href="{{ fix_edit_link_page(get_edit_provider_and_url()[1]) }}" rel="noopener noreferrer"> | ||
<i class="fa-solid fa-pencil" aria-hidden="true"></i> | ||
{% set provider = get_edit_provider_and_url()[0] %} | ||
{% block edit_this_page_text %} | ||
{% if provider %} | ||
{% trans provider=provider %}Edit on {{ provider }}{% endtrans %} | ||
{% else %} | ||
{% trans %}Edit{% endtrans %} | ||
{% endif %} | ||
{% endblock %} | ||
</a> | ||
</nav> | ||
{% else %} | ||
<!-- If there is no fix edit button function, use the PyData edit-this-button--> | ||
{%- include "pydata_sphinx_theme/components/edit-this-page.html" -%} {% endif %} | ||
{# Fallback: Use the PyData theme's edit-this-page button #} | ||
{%- include "pydata_sphinx_theme/components/edit-this-page.html" -%} | ||
{% endif %} |
41 changes: 29 additions & 12 deletions
41
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html
This file contains hidden or 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,14 +1,31 @@ | ||
<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="ast_build_date"></span> | ||
</p> | ||
|
||
<!-- | ||
Theme Version Footer | ||
Displays the Sphinx theme version and the last updated date. | ||
Accessibility and semantic improvements included. | ||
--> | ||
<footer class="theme-version" aria-label="Theme version and last update"> | ||
<span> | ||
{% trans theme_version=ansys_sphinx_theme_version|e %} | ||
Built with the | ||
<a href="https://sphinxdocs.ansys.com/version/stable/index.html" target="_blank" rel="noopener noreferrer"> | ||
Ansys Sphinx Theme | ||
</a> | ||
{{ ansys_sphinx_theme_version }}. | ||
{% endtrans %} | ||
</span> | ||
<br /> | ||
<span>Last updated on <time id="ast_build_date"></time></span> | ||
</footer> | ||
<script> | ||
var options = { day: "numeric", month: "long", year: "numeric" }; | ||
var ast_lastModifiedDate = new Date(document.lastModified); | ||
var ast_build_date = ast_lastModifiedDate.toLocaleDateString("en-US", options); | ||
document.getElementById("ast_build_date").innerHTML = ast_build_date; | ||
// Set the last updated date in a readable format | ||
(function() { | ||
var options = { day: "numeric", month: "long", year: "numeric" }; | ||
var ast_lastModifiedDate = new Date(document.lastModified); | ||
var ast_build_date = ast_lastModifiedDate.toLocaleDateString("en-US", options); | ||
var dateElem = document.getElementById("ast_build_date"); | ||
if (dateElem) { | ||
dateElem.textContent = ast_build_date; | ||
} | ||
})(); | ||
</script> |
43 changes: 24 additions & 19 deletions
43
src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/whatsnew_sidebar.html
This file contains hidden or 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,23 +1,28 @@ | ||
{% if whatsnew %} | ||
<div class="whatsnew-sidebar"> | ||
<ul> | ||
{% for whatsnew in whatsnew %} | ||
{% set title = whatsnew.get('title') %} | ||
{% set url = whatsnew.get('url') %} | ||
{% set title_url = whatsnew.get('title_url') %} | ||
{% set children = whatsnew.get('children') %} | ||
<h2><strong><a href="{{ title_url }}">{{ title }}</a></strong></h2> <!-- Display title as a link --> | ||
<!-- current link --> | ||
<ui> | ||
<!-- child element is dictionary --> | ||
{% for child in children %} | ||
<li><a href="{{ url }}">{{ child }}</a></li> <!-- Display child element as a link --> | ||
{% endfor %} | ||
</ui> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
<!-- add style file --> | ||
<link rel="stylesheet" href="{{ pathto('_static/css/whatsnew.css', 1) }}"> | ||
<ul> | ||
{% for whatsnew in whatsnew %} | ||
{% set title = whatsnew.get('title') %} | ||
{% set url = whatsnew.get('url') %} | ||
{% set title_url = whatsnew.get('title_url') %} | ||
{% set children = whatsnew.get('children') %} | ||
<h2> | ||
<strong> | ||
<a href="{{ title_url }}">{{ title }}</a> | ||
</strong> | ||
</h2> | ||
<!-- current link --> | ||
<ui> | ||
<!-- child element is dictionary --> | ||
{% for child in children %} | ||
<li><a href="{{ url }}">{{ child }}</a></li> <!-- Display child element as a link --> | ||
{% endfor %} | ||
</ui> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
|
||
<!-- add style file --> | ||
<link rel="stylesheet" href="{{ pathto('_static/css/whatsnew.css', 1) }}"> | ||
|
||
{% endif %} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.