During testing of #2689337: Add Prism support as a submodule for codefilter, it was discovered that code with tags in comments doesn't parse correctly.

An example:

/**
 * Callback to escape content of <?php 

, , <% %>, and [% %] elements.
*/
function _codefilter_prism_escape_php_tag_callback($matches) {
return codefilter_prism_escape($matches[2], 'php');
}
?>

Next comment will have a patch which demonstrates the failing functionality (tests should fail).

Comments

cam8001 created an issue. See original summary.

cameron tod’s picture

Status: Active » Needs review
StatusFileSize
new5.64 KB

Status: Needs review » Needs work

The last submitted patch, 2: 2694541-php-code-tags-in-comments.patch, failed testing.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

This patch handles <em>This has an em HTML tag surrounding it</em>, which it seems is over-decoded.

drumm’s picture

StatusFileSize
new6.24 KB

The 0 byte patch was my fault. This should be better.

The last submitted patch, 4: 2694541.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2694541.diff, failed testing.

drumm’s picture

cameron tod’s picture

This was actually solved almost ten years ago, here: #38047: "?>" string prematurely stops syntax highlighting

But I'm not sure the approach in that issue is the one we want to take today.

cameron tod’s picture

Status: Needs work » Needs review
StatusFileSize
new10.15 KB
new185.43 KB
new214.84 KB
new6.35 KB

I got most of the way there on fixing this. There are still some minor test fails, but they seem to be only on trailing carriage returns rather than anything fundamental.

I am uploading this patch for review but will try to sort the failures tonight if I can.

One thing to note is that Prism seems to do something weird with php tags too - even though the raw text output looked ok my end once prism processed it php tags would be missing in the display.

I have attached screenshots of how things look with this patch, with and without Prism.

I'm expecting to see a bunch of fails on this test.

Status: Needs review » Needs work

The last submitted patch, 10: 269451-php-code-tags-in-comments-10.patch, failed testing.