Private
Public Access
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
require_once __DIR__.'/../lib/docset_repository.php';
|
|
require_once __DIR__.'/../lib/docset_renderer.php';
|
|
|
|
$repo = new DocsetRepository();
|
|
$docsetId = (string)($_GET['docset'] ?? '');
|
|
$path = (string)($_GET['path'] ?? '');
|
|
$doc = $repo->resolveDocumentPath($docsetId, $path);
|
|
if(!$doc)
|
|
{
|
|
URL::NotFound('Document not found in docset.');
|
|
URL::$route['page-title'] = 'Not Found';
|
|
?>
|
|
<section class="card warning"><h1>Document not found</h1><p><?= safe(URL::$error) ?></p></section>
|
|
<?php
|
|
return;
|
|
}
|
|
URL::$route['page-title'] = $doc['docset']['name'];
|
|
$documentHtml = DocsetRenderer::renderInlineHtml((string)file_get_contents($doc['file']), $repo, $docsetId, dirname($doc['relative']));
|
|
?>
|
|
<section class="card doc-viewer-shell inline-doc-viewer">
|
|
<div class="viewer-toolbar">
|
|
<div>
|
|
<h1><?= safe($doc['docset']['name']) ?></h1>
|
|
<p><?= safe($doc['relative']) ?></p>
|
|
</div>
|
|
<form method="get" action="<?= URL::Link('') ?>" class="mini-search">
|
|
<input type="hidden" name="docset" value="<?= asafe($docsetId) ?>">
|
|
<input name="q" type="search" placeholder="Search this docset">
|
|
<button type="submit">Search</button>
|
|
</form>
|
|
</div>
|
|
<article class="doc-content">
|
|
<?= $documentHtml ?>
|
|
</article>
|
|
</section>
|