Skip to content

Commit

Permalink
Add <sup> tags around links to footnotes
Browse files Browse the repository at this point in the history
Initially I just added a class to the `<a>` but occurred to me that
actual `<sup>` tags would be semantically better. So.

Tweaked the default CSS to make the `<sup>` tag's font-size `1em`
because otherwise they're `75%` and hard to read and even harder
to tap.

For #330
  • Loading branch information
philgyford committed Aug 14, 2023
1 parent 4a9fcb7 commit ae473fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/assets/_dev/css/elements/typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ blockquote {
@apply border-l-2 border-blue-medium pl-8;
@apply pl-8 py-4 my-8;
}

sup {
font-size: 1em;
}
2 changes: 1 addition & 1 deletion app/assets/_dev/css/pages/publication-front-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ ol.footnotes{
float: right;
font-size: 1.4rem;
}
}
}
1 change: 1 addition & 0 deletions app/modules/content/models/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ def _rewrite_anchor(self, block) -> None:
foot_num = self._footnote_index(link['href']) + 1
link.string = f"[{foot_num}]"
link['name'] = f"source-{foot_num}"
link.wrap(soup.new_tag("sup"))
block['value'] = str(soup)

def _footnote_index(self, href: str) -> int:
Expand Down

0 comments on commit ae473fd

Please sign in to comment.