-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
tpl/tplimpl: Add details shortcode #13100
base: master
Are you sure you want to change the base?
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.
The AssertFileContent method iterates over the values and looks for a match. So it tests if the result contains the value, but it does not test if they are in the given order. I would try to combine these into a single string, possibly using AssertFileContentEquals
instead.
Also, I think our convention with multiple values is to place the closing parenthesis on its own line, e.g.,
b.AssertFileContent("foo",
"bar",
"baz",
)
Thank you for the review! I had noticed AssertFileContent did not check the order. I previously had tried AssertFileContentEquals but it will also check for newlines and whitespace which I thought may make it more prone to triggering false positives in the future. The following would pass the checks: AssertFileContentEquals
Alternatively, I could write a helper function to ignore whitespace and make it a little more robust. Do you have a preference on this? |
I think what you have is fine. |
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.
Just three minor changes.
Also, please squash commits. |
8ee5af8
to
52beeac
Compare
Please clean up the commit message and force push. It should look something like this:
You don't need all the messages from the squashed commits. |
- Add new shortcode to render details HTML element. - Implement integration tests to check: default state, custom summary, open state, safeHTML sanitization, allowed attributes, and localization of default summary text. - Update docs to include details shortcode. Closes gohugoio#13090
52beeac
to
0c1ec70
Compare
Got it, thanks again |
This looks and works great! I recommend we merge this after the tests go green. |
Two comments from me: We cannot have this: {{- printf " %s=%q" $k $v | safeHTMLAttr }} I understand it's ... usefulness, but it would violate Hugo's security policy. Also:
I'm not sure if we're using the pattern above elsewhere, but I think we need to need to namespace the translation keys. I'm not sure what, but Also, for the future, it would be great if we could wait with the implementation until the issue goes from |
Closes #13090