Support Whitehall blockquote changes #81
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces two features of whitehall related to blockquotes, both are somewhat interesting and potentially contentious.
1. Removing quotes from blockquotes
These are removed as quotes are added automatically as part of styling on the frontend. It will change markdown of
> "test"
to> test
.As this was a global applying of a function I placed it outside the extension system as it didn't have a regexp to match - this doesn't feel a very nice way to handle it though, so I welcome suggestions on how to improve this.
This also may not work particularly well. I've used the same code as Whitehall so it has full compatibility, but it does look like there are some dodgy ways it can run.
2. adding a class to the last
<p>
element within a blockquote.For example:
becomes:
To achieve this we've used nokogiri as per the implementation on Whitehall. This has had a number of side effects:
¥
is returned as¥
>
is returned as>
For this feature I've added a PostProcessor class which has a similar extension system to that of the extensions within the main govspeak class, a key difference however being that these are performed on the entire body rather than a matched section. It has the potential though that this could be changed to match a css selector to scope the nokogiri elements coming in.