-
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
Fix footnotes in legislative lists #216
Conversation
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.
Well done for working through this fiddly issue! I've got some code style comments below, but otherwise this looks basically ready to go. However, there is something I'd like to check first. From the first commit:
We currently don't have the ability to render footnotes in Legislative
lists. This workaround substitutes the footnote anchor links (e.g. [^1]
for it's equivalent html.
Do we know why we don't have the ability to render footnotes in Legistlative lists? Is there just a method call we need to invoke somewhere? It feels awfully cumbersome to have to recreate our own footnotes/acronyms markdown parsing logic if it already exists and works elsewhere. Apologies if you've already looked into this, I'm viewing this with fresh eyes and haven't looked too closely at the coal face.
My only other question was whether we're duplicating any of this code - it particularly feels as though the "go to where this is referenced" bit should be encapsulated in one place rather than repeated here.
Thanks @ChrisBAshton! Addressing your comments below:
So this was the part I spent a great deal of time trying to figure out a better workaround. Leglislative lists was a new markdown tag introduced a while back so that editors can have custom numbering for ordered lists and different indentation levels (see this commit which explains in detail) The approach used means a sub document is created and the footnotes only exists inside that document, with some hacks to the Kramdown to make it work.
The html for footnotes doesn't exist at this stage if the document has footnotes in legislative lists, which is why it needs to be manually processed at an earlier point |
c9e5f13
to
b4208bf
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.
Thanks for the explanation, and for making the changes, @deborahchua! This looks good to go 👍 I've got a couple of nitpick comments below, but they're non-blocking.
We currently don't have the ability to render footnotes in Legislative lists. This workaround substitutes the footnote anchor links (e.g. [^1] for it's equivalent html. In order to know whether the document contains legislative lists with footnotes we have to check for this during the preprocess stage. The markdown manually converted to html is then appended or substituted to the html during the document's post process stage.
The link markdown isn't recognised when within a footnote definition. This workaround strips the text out, converts it into html separately and added back in.
In the same way as footnotes, abbreviation markdown isn't recognised in Legislative lists and also when combined with footnote definitions. We extract the acronyms and their alt text, and later substitute their html back into the lists and/or footnote definitions.
b4208bf
to
5e33c7a
Compare
This should now capture all footnote numbers rather than limiting it to 9 and was missed in #216
This should now capture all footnote numbers rather than limiting it to 9 and was missed in #216
What
This fixes an issue with footnotes within legislative lists in Whitehall.
Trello card: https://trello.com/c/yfeqz1no/2561-footnotes-dont-work-within-legislativelist-on-manuals-publisher-5
Why
This has been a longstanding issue and is heavily used in legislation papers.
It means that publishers cannot use footnotes within certain kinds of content, and so cannot always follow the design guidelines. Having markdown that's reliable and effective is helpful for selling our accessibility approach (avoiding PDFs) to policy colleagues.
Visual Changes
Before (footnotes in a legislative list not converted into html):
After (footnotes in a legislative list now showing):
Before (footnote definitions missing):
After (footnote definitions now showing):