Skip to content
Merged
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
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Sadie Bartholomew <sadie.bartholomew@metoffice.gov.uk> Sadie L. Bartholomew <30
Tomek Trzeciak <tomasz.trzeciak@metoffice.gov.uk> <TomekTrzeciak@users.noreply.github.com>
Tomek Trzeciak <tomasz.trzeciak@metoffice.gov.uk> TomekTrzeciak <tomasz.trzeciak@metoffice.gov.uk>
Thomas Coleman <15375218+ColemanTom@users.noreply.github.com>
Samuel Denton <samuel.denton@metoffice.gov.uk> samuel-denton <samuel.denton@metoffice.gov.uk>
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ requests_).
- Elliot Fontaine
- Mark Dawson
- James Frost
- Samuel Denton
<!-- end-shortlog -->

(All contributors are identifiable with email addresses in the git version
Expand Down
10 changes: 10 additions & 0 deletions src/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@
.logo {
height: 7em !important;
}

/* Add an icon to external links, excluding those with the "image-reference" class */
a.external:not(.image-reference)::after {
font-size: 0.7em;
font-weight: bolder;
margin-left: 0.3em;
vertical-align: super;
opacity: 0.5;
content: "↗";
}
31 changes: 31 additions & 0 deletions src/_static/js/extern_links_new_tab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* ----------------------------------------------------------------------------
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ------------------------------------------------------------------------- */

/*
Adds target=_blank to external links so they open in a new tab:
- noopener: prevents the new page accessing window.opener (tabnabbing protection)
- noreferrer: removes referrer info and adds extra safety
- title and aria-label: provide context for screen readers and tooltips
*/
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('a.external').forEach(link => {
link.setAttribute('target', '_blank');
link.setAttribute('rel', 'noopener noreferrer');
link.setAttribute('title', 'Opens in a new tab.');
link.setAttribute('aria-label', 'External link: opens in a new tab');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional information for a screen reader.

});
});
Comment on lines +18 to +31

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure on preferred code/comment style for JS yet, hopefully this is ok?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me.

We generally use eslint "standard" for JS.

23 changes: 17 additions & 6 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,29 @@ def generate_task_icon_modifier_rst():
'sidebar_version_name': None, # override name in version picker
}

html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = ['css/custom.css']

# Disable timestamp otherwise inserted at bottom of every page.
html_last_updated_fmt = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'cylcdoc'

# -- Static file locations -----------------------------------------------
html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
# NOTE: these are added to the end of the default/theme static files, so
# will override them if there are any conflicts.

# Custom CSS
html_css_files = [
'css/custom.css',
]

# Custom JS
html_js_files = [
'js/extern_links_new_tab.js',
]
Comment on lines +248 to +264

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the static file settings to their own block.


# -- Options for LaTeX output ---------------------------------------------

Expand Down
Loading