/** * @dataProvider parseProvider */ public function testParse($expected, $code) { $this->assertSame($expected, rex_markdown::factory()->parse($code)); }
if ($subpage == 'help') { $package = rex_package::get(rex_request('package', 'string')); $name = $package->getPackageId(); $version = $package->getVersion(); $author = $package->getAuthor(); $supportPage = $package->getSupportPage(); if (is_readable($package->getPath('help.php'))) { if (!$package->isAvailable() && is_readable($package->getPath('lang'))) { rex_i18n::addDirectory($package->getPath('lang')); } ob_start(); $package->includeFile('help.php'); $content .= ob_get_clean(); } elseif (is_readable($package->getPath('README.md'))) { $fragment = new rex_fragment(); $fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($package->getPath('README.md'))), false); $content .= $fragment->parse('core/page/docs.php'); } else { $content .= rex_view::info(rex_i18n::msg('package_no_help_file')); } $fragment = new rex_fragment(); $fragment->setVar('title', rex_i18n::msg('package_help') . ' ' . $name, false); $fragment->setVar('body', $content, false); echo $fragment->parse('core/page/section.php'); $credits = ''; $credits .= '<dl class="dl-horizontal">'; $credits .= '<dt>' . rex_i18n::msg('credits_name') . '</dt><dd>' . htmlspecialchars($name) . '</dd>'; if ($version) { $credits .= '<dt>' . rex_i18n::msg('credits_version') . '</dt><dd>' . $version . '</dd>'; } if ($author) {
/** * Includes the sub-path of current page. * * @param array $context * * @return mixed */ public static function includeCurrentPageSubPath(array $context = []) { $path = self::getCurrentPageObject()->getSubPath(); if ('.md' !== strtolower(substr($path, -3))) { return self::includePath($path, $context); } $fragment = new rex_fragment(); $fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($path)), false); $content = $fragment->parse('core/page/docs.php'); $fragment = new rex_fragment(); $fragment->setVar('body', $content, false); echo $fragment->parse('core/page/section.php'); }