Looking at jjj's patch, it seemed to me that nesting them would break things, as in it would end the $in_code flag early, which does seem to be the case. The last test fails; however, I'm not sure that you're supposed to have a code element inside pre unless it wraps everything as well, e.g. <pre><code>blah</code></pre>. See ​http://www.w3.org/TR/html5/grouping-content.html#the-pre-element

Looking at jjj's patch, it seemed to me that nesting them would break things, as in it would end the $in_code flag early, which does seem to be the case. The last test fails; however, I'm not sure that you're supposed to have a code element inside pre unless it wraps everything as well, e.g. <pre><code>blah</code></pre>. See ​http://www.w3.org/TR/html5/grouping-content.html#the-pre-element

your unit test looks good to me. i added a nested level count in 23756.2.diff​​ and your test now passes! not sure pre tag surrounding code is right, but it is going to happen, so makes sense to account for the possibility. even in the w3.org page you linked they have nested that way in their sample code. ​http://cl.ly/Qp6K

I updated the test to include code and pre tags with attributes as well as custom tags that start with the words 'code' or 'pre'. This caused the test to fail. I then updated the function part of the patch to pass the test.

I've been watching this ticket, as this is an issue that affects the handbooks. The handbooks use the ​SyntaxHighlighter Evolved plugin, and all of the code samples containing URLs are broken (they display full markup for a URL instead of just the URL). See ​Automated Testing > Installation for an example.

I applied 23756.5.diff​ to my local install (latest trunk), tested, and got the expected results listed in the unit test.

This patch also fixed my local test code samples using the shortcodes in the plugin (no markup added to URLs).

There is some prior art of not mangling certain parts of the HTML in wptexturize(). Look at the bottom of the function. It handles more cases – some shortcodes (code), more tags (kbd, style, script, tt), handles some invalid HTML cases, supports filtering the disabled tags/shortcodes.

It’d be great if the logic for the two can be consolidated, because for example now make_clickable will convert URLs in script tags and in shortcodes.

if anybody else is excited, I’d be happy to help.

P.S. I wrote the older code, but I’m pretty embarrassed of functions like _wptexturize_pushpop_element :-)