]> git.proxmox.com Git - pve-docs.git/commitdiff
mediawiki: bring doc includer again in line with the HTMLets plug it bases on
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 26 Jul 2019 06:52:04 +0000 (08:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 26 Jul 2019 06:52:08 +0000 (08:52 +0200)
We probably always wanted to use a real HTML comment as "tag" here,
but it seems the '!' was forgotten. With older mediawiki it still
worked, but 1.31 got stricter and thus it was converted to HTML
entities.

Bring the plugin again in line with the HTMLets MediaWiki
extension[0] it based on in the first place.

[0]: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
debian/tree/pve-docs-mediawiki/pvedocs-include.php

index f8d62d42d9ea0d5f0d4ecc4095d93e3c3ac2bf8f..78a6829ffea7e6279d2136e2a1b77c1718fe33d9 100644 (file)
@@ -28,7 +28,7 @@ function efPvedocsParserFunction_Setup(&$parser) {
 # similar code as in <htmlet> tag...
 function efPvedocsPostProcessFunction($parser, &$text) {
        $text = preg_replace_callback(
 # similar code as in <htmlet> tag...
 function efPvedocsPostProcessFunction($parser, &$text) {
        $text = preg_replace_callback(
-               '/-_- @PVEDOCS_BASE64@ ([0-9a-zA-Z\\+\\/]+=*) @PVEDOCS_BASE64@ -_-/sm',
+               '/<!--- @PVEDOCS_BASE64@ ([0-9a-zA-Z\\+\\/]+=*) @PVEDOCS_BASE64@ -->/sm',
                function ($m) { return base64_decode("$m[1]"); },
                $text);
 
                function ($m) { return base64_decode("$m[1]"); },
                $text);
 
@@ -66,9 +66,8 @@ function efPvedocsParserFunction_Render($parser, $param1 = '', $param2 = '') {
 
        $content = file_get_contents("/usr/share/pve-docs/$param1");
 
 
        $content = file_get_contents("/usr/share/pve-docs/$param1");
 
-    # do not use '<' or '>', it seems newer mediawiki converts it to '&lt;' and '&gt;'
-    # and then the regex for the decode in efPvedocsPostProcessFunction does not matches..
-    $output = '-_- @PVEDOCS_BASE64@ '.base64_encode($content).' @PVEDOCS_BASE64@ -_-';
+    # from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140
+    $output = '<!--- @PVEDOCS_BASE64@ '.base64_encode($content).' @PVEDOCS_BASE64@ -->';
     return array($output, 'noparse' => true, 'isHTML' => true);
 }
 
     return array($output, 'noparse' => true, 'isHTML' => true);
 }