From 72f3ce69a7d71a3817c0d6e57b345724703beb79 Mon Sep 17 00:00:00 2001 From: Kevin-OConnor Date: Tue, 28 Sep 2021 20:32:09 -0400 Subject: [PATCH] Italicize first (#1434) * Italicize FIRST everywhere The text "FIRST" appears on the page in a number of spots where we can't italicize it normally in the RST (navbar heading, copywrite notice, etc.) so this JS finds all instances and italicizes. * Remove extra spaces Remove extra spaces --- source/_static/js/italicize_first.js | 10 ++++++++++ source/conf.py | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 source/_static/js/italicize_first.js diff --git a/source/_static/js/italicize_first.js b/source/_static/js/italicize_first.js new file mode 100644 index 0000000000..98e13bcb56 --- /dev/null +++ b/source/_static/js/italicize_first.js @@ -0,0 +1,10 @@ +$(document).ready(function () { + // get all body content as a string + var str = document.body.innerHTML; + + // find all magic words and wrap them in a tag + var result = str.replace(/(FIRST)/g, "$1"); + + // set all body content HTML with new processed content + document.body.innerHTML = result; +}); diff --git a/source/conf.py b/source/conf.py index 86a40a1616..66249b53ea 100644 --- a/source/conf.py +++ b/source/conf.py @@ -200,6 +200,9 @@ def setup(app): # Launch external links in a new tab/window app.add_js_file("js/external-links-new-tab.js") + # Italicize instances of FIRST + app.add_js_file("js/italicize_first.js") + # -- Options for latex generation --------------------------------------------