Skip to content
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

Don't auto link patterns surrounded by """. #322

Merged
merged 2 commits into from Mar 5, 2019

Conversation

aelzenaar
Copy link
Contributor

This allows the prevention of [WikiWikiWeb](http://wiki.c2.com/?WikiWikiWeb) being transformed to <a href="http://wiki.c2.com/?&lt;a href=&quot;aw.cgi?page=WikiWikiWeb&quot;&gt;WikiWikiWeb&lt;/a&gt;">WikiWikiWeb</a> when the pattern linker sees the second WikiCase word if the author surrounds it with triple quotes: so [WikiWikiWeb](http://wiki.c2.com/?"""WikiWikiWeb""") is now transformed to <a href="http://wiki.c2.com/?WikiWikiWeb">WikiWikiWeb</a>.

The function responsible, _do_link_patterns(), already checked for the cases that the pattern was inside square brackets, or was preceeded by ]( or suffixed by "), and skips expanding in these cases. This addition simply adds a check that the pattern is not surrounded by triple quotes; the triple quotes are stripped from the output.

This allows the prevention of `[WikiWikiWeb](http://wiki.c2.com/?WikiWikiWeb)`
being transformed to `<a href="http://wiki.c2.com/?&lt;a href=&quot;aw.cgi?page=WikiWikiWeb&quot;&gt;WikiWikiWeb&lt;/a&gt;">WikiWikiWeb</a>` when
the pattern linker sees the second WikiCase word by surrounding it with triple quotes: so `[WikiWikiWeb](http://wiki.c2.com/?"""WikiWikiWeb""")`
is now transformed to `<a href="http://wiki.c2.com/?WikiWikiWeb">WikiWikiWeb</a>`.

The function responsible, _do_link_patterns(), already checked for the cases that the pattern was inside square brackets, or
was preceeded by `](` or suffixed by `")`, and skips expanding in these cases. This addition simply adds a check that the pattern is not surrounded
by triple quotes; the triple quotes are stripped from the output.
@nicholasserra
Copy link
Collaborator

Thanks! Can you add a test case exercising the change in question?

@aelzenaar
Copy link
Contributor Author

OK, will do

@aelzenaar
Copy link
Contributor Author

And added!

@nicholasserra nicholasserra merged commit 5667462 into trentm:master Mar 5, 2019
@nicholasserra
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants