-
Notifications
You must be signed in to change notification settings - Fork 22
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
Prevent user error when incorrectly formatted footnotes are added to HTML attachments #287
Conversation
2bd1f40
to
539b6c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code change looks good 👍.
I've made a suggestion for the CHANGELOG, to clarify that this only affects incorrectly formatted footnotes.
I'd also suggest adding an example of the incorrect formatting we saw in this document into the commit message, so there's a permanent record of the problem being solved here.
CHANGELOG.md
Outdated
@@ -1,3 +1,7 @@ | |||
## Unreleased | |||
|
|||
* Prevent user error when footnotes are added to HTML attachments ([#287](https://github.com/alphagov/govspeak/pull/287)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Prevent user error when footnotes are added to HTML attachments ([#287](https://github.com/alphagov/govspeak/pull/287)) | |
* Prevent user error when incorrectly formatted footnotes are added to HTML attachments ([#287](https://github.com/alphagov/govspeak/pull/287)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @brucebolt - I removed the reference to incorrect formatting as I was still getting issues when I removed the example we found. But now I've realised the footnote above the one we identified was broken as well, as it contained |
which I think was triggering the table formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll reintroduce the wording you suggested
539b6c5
to
b7648c5
Compare
…HTML attachments When footnotes are used in HTML attachments, this function would cause an unhelpful user error to be displayed. This will allow the attachment to save. Example of incorrectly formatted footnotes: [^22]: CDC. Centre for Disease Control and Prevention. Invasive Mold Infections in Immunocompromised People [updated 06/06/2019]. Available from: Invasive Mold Infections in Immunocompromised People | Mold | CDC 23. David J. Pevalin, Aaron Reeves, Emma Baker, Rebecca Bentley, The impact of persistent poor housing conditions on mental health: A longitudinal population-based study, Preventive Medicine, Volume 105, 2017, Pages 304-310, https://doi.org/10.1016/j.ypmed.2017.09.020 22 contains the character | which triggers table formatting. 23 is not correctly formatted as a footnote. Co-authored-by: Bruce Bolt <[email protected]>
b7648c5
to
b9199e8
Compare
When incorrectly formatted footnotes are used on HTML attachments in Whitehall, the function would cause an unhelpful user error to be displayed.
html.gsub!
seemed to crash with footnotes in an attachment, ashtml
was nil: https://govuk.sentry.io/issues/4415164546/?project=202259&query=is%3Aunresolved&referrer=issue-stream&stream_index=0This will allow the attachment to save.
This repo is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.