bradyvercher / gistpress

WordPress plugin to add Gist oEmbed and shortcode support with caching.
GNU General Public License v2.0
143 stars 28 forks source link

Bug when regular expression replacement in Gist #32

Closed GaryJones closed 11 years ago

GaryJones commented 11 years ago

Try embedding the following:

https://gist.github.com/GaryJones/c2b4fa187066489729cb

That uses preg_replace() with a backreference in the replacement string. PHP-wise, it works. However, from the embedded view of the gist, you'll see it gets mangled.

Looking in the database, the raw transient seems to be fine, but by the time it gets to the html transient, the $1 is gone. Presumably something in process_gist_html() is the culprit.

Trying with ${1} as the backreference seemed to make no difference.

Any ideas @bradyvercher?

GaryJones commented 11 years ago

Looking closer at the differences between the raw and html transients, $1 is getting replaced with <pre class="line-pre">.

GaryJones commented 11 years ago

This commit seems to fix it, thank you.