Skip to content

Instantly share code, notes, and snippets.

@towerofnix
Created September 20, 2016 19:59
Show Gist options
  • Save towerofnix/9cc7a6efc8ad8a26d32662a987c75c5c to your computer and use it in GitHub Desktop.
Save towerofnix/9cc7a6efc8ad8a26d32662a987c75c5c to your computer and use it in GitHub Desktop.
<sa> - Small <a>s
// <sa> - small <a>
const dictionary = {
'congruent': '#definition-of-congruent',
'right angle': '#definition-of-right-angle',
'right angles': '#definition-of-right-angle',
'definition of supplementary': '#definition-of-supplementary',
'congruent supplementary angles': '#congruent-supplementary-angles'
}
for (let sa of document.querySelectorAll('sa')) {
const text = sa.textContent.toLowerCase()
const a = document.createElement('a')
if (dictionary.hasOwnProperty(text)) {
a.href = dictionary[text]
}
a.textContent = sa.textContent
sa.parentNode.insertBefore(a, sa)
sa.remove()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment