2018-06-04 02:18:02 +00:00
|
|
|
<?php
|
2021-01-03 23:57:28 +00:00
|
|
|
$filepath = __FILE__;
|
2018-06-04 02:18:02 +00:00
|
|
|
require __DIR__.'/../vendor/autoload.php';
|
2021-03-17 17:14:23 +00:00
|
|
|
use tildeteam\wiki;
|
2018-06-09 00:31:07 +00:00
|
|
|
|
2018-08-16 04:27:46 +00:00
|
|
|
$additional_head = "
|
|
|
|
<meta property='og:type' content='website'>
|
|
|
|
<meta property='og:image' content='https://tilde.team/apple-icon.png'>
|
|
|
|
<meta property='og:site_name' content='tilde.team wiki'>
|
|
|
|
";
|
2018-06-04 02:18:02 +00:00
|
|
|
|
2022-02-15 03:02:41 +00:00
|
|
|
$parser = wiki::factory(true);
|
2018-06-05 14:53:42 +00:00
|
|
|
|
|
|
|
if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
2018-08-16 04:27:46 +00:00
|
|
|
|
2018-06-09 00:36:52 +00:00
|
|
|
$title = "tilde.team~wiki";
|
2018-06-09 20:38:45 +00:00
|
|
|
$additional_head .= "
|
|
|
|
<meta property='og:title' content='$title'>
|
2018-06-20 16:02:28 +00:00
|
|
|
<meta property='og:url' content='https://tilde.team{$_SERVER['REQUEST_URI']}'>
|
2018-06-09 14:28:17 +00:00
|
|
|
<meta property='og:description' content='tilde.team wiki'>
|
2018-06-09 20:38:45 +00:00
|
|
|
";
|
|
|
|
include __DIR__.'/../header.php';
|
2022-07-12 16:45:42 +00:00
|
|
|
|
|
|
|
$pages = [];
|
|
|
|
foreach (glob("pages/*.md") as $page) {
|
|
|
|
$yaml = $parser->parse(file_get_contents($page))->getYAML();
|
|
|
|
if (!$yaml["published"]) continue;
|
|
|
|
$pages[] = [
|
|
|
|
"title" => $yaml["title"],
|
|
|
|
"description" => $yaml["description"],
|
|
|
|
"name" => basename($page, ".md"),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
usort($pages, function($a, $b) { return $a["title"] <=> $b["title"]; });
|
|
|
|
|
2018-06-09 20:38:45 +00:00
|
|
|
// render wiki index ?>
|
2018-06-09 02:44:26 +00:00
|
|
|
|
2018-06-09 00:36:52 +00:00
|
|
|
<h1>tilde.team wiki</h1>
|
2018-06-04 02:18:02 +00:00
|
|
|
|
2018-06-09 00:36:52 +00:00
|
|
|
<p>welcome to the tilde.team wiki!</p>
|
2018-06-04 02:18:02 +00:00
|
|
|
|
2018-08-09 14:28:14 +00:00
|
|
|
<p>if you want to contribute, check out the
|
2018-09-07 16:58:58 +00:00
|
|
|
<a href="https://tildegit.org/team/site/src/branch/master/wiki">source</a> and open a PR!
|
2018-08-08 17:09:33 +00:00
|
|
|
</p>
|
2018-06-04 02:18:02 +00:00
|
|
|
|
2018-06-09 00:36:52 +00:00
|
|
|
<hr>
|
2021-03-29 15:57:03 +00:00
|
|
|
<h2>pages:</h2>
|
2022-06-14 23:12:00 +00:00
|
|
|
<table class="table table-responsive table-hover table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>title</th>
|
|
|
|
<th>description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-07-12 16:45:42 +00:00
|
|
|
<?php foreach ($pages as $page) { ?>
|
|
|
|
<tr>
|
|
|
|
<td><a href="<?=$page["name"]?>"><?=$page["title"]?></a></td>
|
|
|
|
<td><?=$page["description"] ?? ""?></td>
|
|
|
|
</tr>
|
2022-06-14 23:12:00 +00:00
|
|
|
<?php } ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2018-06-04 06:18:28 +00:00
|
|
|
|
2021-03-29 15:57:03 +00:00
|
|
|
|
|
|
|
<?php } else {
|
2018-08-16 04:27:46 +00:00
|
|
|
|
2018-06-09 00:36:52 +00:00
|
|
|
$pg = $parser->parse(file_get_contents("pages/{$_GET["page"]}.md"));
|
2018-06-09 17:24:47 +00:00
|
|
|
$yml = $pg->getYAML();
|
|
|
|
$title = $yml['title'] . " | tilde.team~wiki";
|
|
|
|
$description = $yml['description'] ?? "tilde.team wiki article {$yml['title']}";
|
|
|
|
$additional_head .= "
|
|
|
|
<meta property='og:title' content='$title'>
|
|
|
|
<meta property='og:url' content='https://tilde.team{$_SERVER['REQUEST_URI']}'>
|
|
|
|
<meta property='og:description' content='$description'>
|
|
|
|
";
|
2018-06-09 00:36:52 +00:00
|
|
|
include __DIR__.'/../header.php';
|
2018-06-05 14:53:42 +00:00
|
|
|
// show a single page ?>
|
2018-06-09 00:36:52 +00:00
|
|
|
|
2018-06-09 03:17:35 +00:00
|
|
|
<a href=".">< ~wiki</a>
|
2022-02-16 17:33:28 +00:00
|
|
|
<h1><?=$yml['title']?></h1>
|
2018-06-09 02:44:26 +00:00
|
|
|
|
2022-02-15 03:02:41 +00:00
|
|
|
<?=$pg->getContent()?>
|
2018-06-05 14:53:42 +00:00
|
|
|
<hr>
|
2018-09-07 16:58:58 +00:00
|
|
|
<a href="https://tildegit.org/team/site/src/branch/master/wiki/pages/<?=$_GET["page"]?>.md">
|
2018-06-07 20:57:47 +00:00
|
|
|
<i class="fa fa-edit"></i> source
|
|
|
|
</a>
|
2018-08-16 04:27:46 +00:00
|
|
|
|
2018-06-05 14:53:42 +00:00
|
|
|
<?php }
|
2018-06-04 06:18:28 +00:00
|
|
|
|
2018-06-04 02:18:02 +00:00
|
|
|
include __DIR__.'/../footer.php';
|