From df6eb6ab1712f60d373ffbab00f04c537fd23db7 Mon Sep 17 00:00:00 2001 From: Tim McMackin Date: Thu, 1 Aug 2024 09:57:32 -0400 Subject: [PATCH 1/2] Fix hash for glossary headings --- src/scripts/process_downloaded_glossary.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/scripts/process_downloaded_glossary.js b/src/scripts/process_downloaded_glossary.js index fd1f73b81..e816ad791 100644 --- a/src/scripts/process_downloaded_glossary.js +++ b/src/scripts/process_downloaded_glossary.js @@ -67,6 +67,16 @@ const process_glossary = async () => { } }); + // Convert section header links to match the rest of the site + const sectionHeaderLinks = trimmed.querySelectorAll('a.headerlink'); + sectionHeaderLinks.forEach((link) => { + link.setAttribute('class', 'hash-link'); + const title = link.parentNode.firstChild.textContent; + link.setAttribute('aria-label', 'Direct link to' + title); + link.setAttribute('title', 'Direct link to' + title); + link.textContent = ''; + }); + // Wrap with
to apply custom styles const wrapper = new JSDOM('
'); const imported_glossary = wrapper.window.document.querySelector('div#imported-glossary'); From cd69a5521f7bf39f14f1374d0e03c57aff9c15cf Mon Sep 17 00:00:00 2001 From: Tim McMackin Date: Thu, 1 Aug 2024 10:03:55 -0400 Subject: [PATCH 2/2] Add a space --- src/scripts/process_downloaded_glossary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/process_downloaded_glossary.js b/src/scripts/process_downloaded_glossary.js index e816ad791..e374372aa 100644 --- a/src/scripts/process_downloaded_glossary.js +++ b/src/scripts/process_downloaded_glossary.js @@ -72,8 +72,8 @@ const process_glossary = async () => { sectionHeaderLinks.forEach((link) => { link.setAttribute('class', 'hash-link'); const title = link.parentNode.firstChild.textContent; - link.setAttribute('aria-label', 'Direct link to' + title); - link.setAttribute('title', 'Direct link to' + title); + link.setAttribute('aria-label', 'Direct link to ' + title); + link.setAttribute('title', 'Direct link to ' + title); link.textContent = ''; });