2019-09-14 14:29:05 -04:00
|
|
|
<?php
|
|
|
|
|
$title = "tilde.club wiki";
|
|
|
|
|
include __DIR__."/../header.php";
|
|
|
|
|
?>
|
|
|
|
|
|
2020-05-06 23:41:08 -06:00
|
|
|
<h1 id="fancyboi">the tilde.club wiki</h1>
|
2020-05-06 01:50:51 -06:00
|
|
|
|
|
|
|
|
<div class="grid">
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
|
|
<div class="col">
|
2019-09-14 14:29:05 -04:00
|
|
|
|
|
|
|
|
<p>here's the articles on our wiki:</p>
|
|
|
|
|
<ul>
|
2020-04-12 01:09:33 -07:00
|
|
|
<?php
|
2020-04-12 22:21:15 -07:00
|
|
|
$category_to_articles = [];
|
2020-04-12 01:09:33 -07:00
|
|
|
foreach (glob("source/*.md") as $file) {
|
|
|
|
|
$article = basename($file, ".md");
|
|
|
|
|
$title = preg_match("/title: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : $article;
|
2020-04-12 22:21:15 -07:00
|
|
|
$category = preg_match("/category: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : 'default';
|
|
|
|
|
if (array_key_exists($category, $category_to_articles)) {
|
|
|
|
|
array_push($category_to_articles[$category], [$article, $title]);
|
|
|
|
|
} else {
|
|
|
|
|
$category_to_articles[$category] = [[$article, $title]];
|
|
|
|
|
}
|
|
|
|
|
ksort($category_to_articles);
|
2020-04-12 01:09:33 -07:00
|
|
|
}
|
|
|
|
|
?>
|
2020-04-12 22:21:15 -07:00
|
|
|
<?php foreach ($category_to_articles as $category => $articles) { ?>
|
|
|
|
|
<li><?=$category?></li>
|
|
|
|
|
<ul>
|
|
|
|
|
<?php
|
|
|
|
|
$article_titles = [];
|
|
|
|
|
$article_names = [];
|
|
|
|
|
foreach ($articles as $article) {
|
|
|
|
|
array_push($article_names, $article[0]);
|
|
|
|
|
array_push($article_titles, $article[1]);
|
|
|
|
|
}
|
|
|
|
|
$name_to_title = array_combine($article_names, $article_titles);
|
|
|
|
|
asort($name_to_title);
|
|
|
|
|
foreach ($name_to_title as $name => $title) { ?>
|
|
|
|
|
<li><a href="/wiki/<?=$name?>.html"><?=$title?></a></li>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<?php } ?>
|
2019-09-14 14:29:05 -04:00
|
|
|
</ul>
|
2020-05-06 01:50:51 -06:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php include "../footer.php"; ?>
|