-
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
Support acronyms within example and address blocks #350
Conversation
9f3e868
to
48c777c
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.
Like George, I'm not super familiar with the syntax here, but the tests and their similarity to other acronym tests give me sufficient confidence this does the job
The labels/first lines of each of the comments here are following the Conventional Comments format, which I'm trying out after watching a useful DevOpsDays London talk
extension("example", surrounded_by("$E")) do |body| | ||
<<~BODY | ||
<div class="example" markdown="1"> | ||
#{body.strip.gsub(/\A^\|/, "\n|").gsub(/\|$\Z/, "|\n")} |
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.
suggestion (if-minor): documentation
Is this some kind of default? I can see that it's the same as what's done with CTAs, but it's different to how the address blocks code looks. Is there code or other documentation that could be linked to in this and maybe the next commit message to explain why:
- moving from
wrap_with_div ... Govspeak::Document
to this RegEx is suitable here? markdown="1"
seems to be the key change for the abbreviation substitution to kick in (based on the next commit)
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'd just copied this from CTAs, but it turns out .gsub(/\A^\|/, "\n|").gsub(/\|$\Z/, "|\n")
allows support for tables within the block.
I think that's useful and can't see anything in the documentation to suggest that shouldn't be allowed, so I've added it as a separate commit with an explanation.
I'll also add some detail to the commits about the markdown="1"
being the key to getting these to include acronyms.
@@ -1247,6 +1247,20 @@ class GovspeakTest < Minitest::Test | |||
) | |||
end | |||
|
|||
test_given_govspeak " |
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.
thought: documentation
Would be nice if this method took some kind of human-readable description argument, but now's probably not the time to go adding that to this massive spec!
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.
It would be nice to break this huge file down into some smaller ones, or even just wrap some context blocks around things. I'll add a card to the backlog so it's not forgotten, as I don't think it'll be a trivial task to understand what exactly is being tested in each example.
These were not previously supported, so updating them to work in the same way as call to action blocks. Adding `markdown="1"` to the surrounding block tells Kramdown that the content needs further markdown parsing, otherwise it just ignores any markdown within HTML.
This matches their behaviour with call to action, which is a similar block.
These were not previously supported, so updating them to work in the same way as call to action blocks. Adding `markdown="1"` to the surrounding block tells Kramdown that the content needs further markdown parsing, otherwise it just ignores any markdown within HTML.
48c777c
to
75fd234
Compare
Fixes an issue where acronyms are not correctly marked up when within example or address blocks.
Trello card