Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix footnotes to work within call-to-action boxes. #222

Merged
merged 2 commits into from
Nov 2, 2021

Conversation

baisa
Copy link
Contributor

@baisa baisa commented Oct 22, 2021

Trello card

What

We need to parse footnotes when they appear in $CTA call-to-action boxes. Currently they appear as markdown ([^1]).

Why

In call to action boxes ($CTA), footnotes don't work and are just shown as markdown - [^1] - meaning for some publications where there's a need to use GOV.UK patterns to replicate some styling in a printed publication isn't possible.

@baisa baisa marked this pull request as ready for review October 22, 2021 14:52
Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

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

This looks great - thanks @baisa 👏

Just a couple of suggestions on the contents of the tests.

test/govspeak_test.rb Show resolved Hide resolved
test/govspeak_test.rb Show resolved Hide resolved
footnotes = source.scan(/\[\^(\d+)\]:(.*)/)
@acronyms = source.scan(/(?<=\*)\[(.*)\]:(.*)/)

if is_legislative_list && footnotes.size.positive?
if (is_legislative_list || is_cta) && footnotes.size.positive?
Copy link
Contributor

Choose a reason for hiding this comment

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

I like how you've reused the existing logic 👍

@baisa baisa force-pushed the Footnotes-in-call-to-action-boxes branch from 6196bd3 to 17b72e6 Compare November 1, 2021 12:55
We need to parse footnotes when they appear in $CTA call-to-action boxes as currently they appear as markdown. Added tests.
@baisa baisa force-pushed the Footnotes-in-call-to-action-boxes branch from 17b72e6 to c3f1213 Compare November 1, 2021 15:36
Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

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

The changes look great - nice one! 👏

CHANGELOG.md Outdated Show resolved Hide resolved
@baisa baisa force-pushed the Footnotes-in-call-to-action-boxes branch from c3f1213 to 43c1ad4 Compare November 2, 2021 09:34
@baisa baisa merged commit ab9ab6f into main Nov 2, 2021
@baisa baisa deleted the Footnotes-in-call-to-action-boxes branch November 2, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants