setFunctionHook('pvedocs', [ self::class, 'efPvedocsParserFunction_Render' ]); $parser->setHook('pvehide', [ self::class, 'renderTagPveHideContent' ]); return true; } // similar code as in tag... public static function efPvedocsPostProcessFunction($parser, &$text) { $text = preg_replace_callback( '//sm', function ($m) { return base64_decode("$m[1]"); }, $text ); return true; } // "Render" public static function renderTagPveHideContent($input, array $args, Parser $parser, PPFrame $frame ) { return ''; // simply return nothing } # Render the output of {{#pvedocs:chapter}}. public static function efPvedocsParserFunction_Render(Parser $parser, $doc = '') { $parser->getOutput()->updateCacheExpiry(0); // disableCache() was dropped in MW 1.34 // only allow simple names, so that jist files from within "/usr/share/pve-docs/" can be included if (!preg_match("/[a-z0-9.-]+\.html/i", $doc)) { die("no such manual page"); } // load JS helper for TOC/footnote generation and load actual HTML content fom docs $content = "\n"; $content .= file_get_contents("/usr/share/pve-docs/$doc"); // from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140 $output = ''; return array($output, 'noparse' => true, 'isHTML' => true); } }