-
Notifications
You must be signed in to change notification settings - Fork 215
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
Ignore # characters inside double quotes and backticks #658
Ignore # characters inside double quotes and backticks #658
Conversation
e52bdc7
to
6252386
Compare
This looks very good to me. The only thing I can think of is that we could add some tests which mix both double quotes as well as backticks and nest them in different ways. Looking at the code these conditions are correctly handled, but the tests do not verify them. |
@noctux pointed out that I never reset |
@der-lyse, good suggestion; will do! |
Another one from @noctux over on IRC: how should |
Turns out @der-lyse's idea proved extremely useful. I realized that double quotes inside backticks shouldn't start a quoted string, and had to fix that. Backticks take precedence over quotes. For example,
Which is counter-intuitive, since double quotes aren't balanced in the original string; yet that's how it works. Sorry for the messy history, but it took some experimentation to figure out the behaviour of Looking forward for your further reviews! |
I realized the function doesn't need to return a fancy |
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.
Puh, the tests were really difficult to read and check, especially as the raw strings are delimited with "
and #
. ;-) I hope nothing slipped through.
Backticks and
#
characters can be escaped with a backslash (+`+); in that case, they'll be replaced with a literal backtick/#
in the configuration.
Just a small thing regarding the docs: You could also cite the escaped pound sign ((+\#+)
) along with the escaped backtick ((+\
+)`) to make it consistent with the added pound sign at the end of the sentence.
Oops, it actually doesn't even render properly ._. Fighting with it now. I'll apply your suggestion as well; thanks! @noctux, any comments on what I got here? Do you think this is ready for merge? |
Phew, figured it out. Apparently |
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.
Looks good to me now and the tests look convincing.
Cool; thank you both very much! I'll release 2.17.1 tomorrow. |
Had to tweak an existing test, because it codified the wrong behaviour.
da8f63b
to
6b080e6
Compare
When reviewing #584, I didn't consider that a pound character can appear inside titles or regexes, not just in front of a comment. This introduced a regression, which was reported in #652 when 2.17 was released.
This PR makes
utils::strip_comments
aware of double quotes and backticks, so it now ignores pound signs inside.I'd be really happy if someone reviewed this within 20 hours, so I can make a release on Sunday. Otherwise I'll wait my ordinary three days, and release this on Thursday.