Is the pmwiki integration still supported?

0 votes
asked Sep 15 in Bug by Morphit (160 points)

On the website here:, the link to the cookbook code is not rendered correctly.

The code is available at but didn't work off the bat. I had to make a few changes to get it to work with pmwiki Version 2.3.10 (though I note that Version 2.3.25 is the current latest).

--- pmplantuml_php.txt  2020-02-01 20:07:10.000000000 +0000
+++ pmplantuml.php      2023-09-15 15:06:02.711068260 +0000
@@ -34,22 +34,24 @@
 function doplantuml($str) {
        global $KPV, $KeepToken;

-       $str = preg_replace( "/$KeepToken(\\d+?)$KeepToken/e", '$KPV[$1]', $str);
+       $str = PPRE( "/$KeepToken(\\d+?)$KeepToken/", '$KPV[$1]', $str[0]);
+       // pmwiki can insert vspace when a blank line is present
+       $str = preg_replace( "<<:vspace>>", "", $str);
        $str = preg_replace( "/&gt;/", ">", $str);
        $str = preg_replace( "/&lt;/", "<", $str);

-       $url = "";
+       $url = "";
        $url .= encodep($str);
        return Keep('<img src='.$url.' />');

-       '/(@start\w+.*?@end\w+)/sexi',
-       'doplantuml("$1")');
+       '/(@start\w+.*?@end\w+)/sxi',
+       "doplantuml");

 function encodep($text) {
-     $data = utf8_encode($text);
+     $data = $text;
      $compressed = gzdeflate($data, 9);
      return encode64($compressed);

 utf8_encode is deprecated as of PHP 8.2.0 but their alternatives seem to be plugins to PHP. I'm not clear on why input text should be treated as ISO-8859-1. I tried greek utf8 characters and the rendering seems fine.

The /e modifier has been deprecated but I'm not sure what it did originally. I think it might be to do with how the callback function gets called but my changes seem to work besides needing to erase spurious `<vspace>` tags.

Should these changes be pushed to the website? I'm not that familiar with PHP so it'd be good to have someone else look it over first.



Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.