An RFC system for the tildeverse https://rfc.tildeverse.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

99 lines
2.2 KiB

<?php
include __DIR__.'/../vendor/autoload.php';
$parser = Tildeverse\Wiki\Parser::factory();
if (isset($_GET["number"])) {
$num = $_GET["number"];
} elseif (count($_GET) == 1) {
$num = array_keys($_GET)[0];
} else {
$num = "";
}
$filename = "rfc{$num}.md";
if (file_exists($filename)) {
$document = $parser->parse(file_get_contents($filename));
$yml = $document->getYAML();
$content = $document->getContent();
$title = $yml['title'] ?? 'invalid';
$author = htmlspecialchars($yml['author']);
$description = "RFC {$yml['number']}: {$yml['title']} by {$author}";
include __DIR__.'/../header.php';
?>
<a href=".">&lt; back to list</a>
<h1>RFC <?=$yml['number']?>: <?=$yml['title']?></h1>
<p>Author: <?=$author?></p>
<p>Status: <?=$yml["status"]?></p>
<br />
<?php if (isset($yml['updates'])) { ?>
Updates:
<?php
$arr = explode(", ", $yml['updates']);
foreach ($arr as $num) {
echo "<a href='/rfcs/{$num}'>{$num}</a>";
if (next($arr)) {
echo ", ";
}
}
?>
<br />
<?php };?>
<?php if (isset($yml['updated-by'])) { ?>
Updated by:
<?php
$arr = explode(", ",$yml['updated-by']);
foreach ($arr as $num) {
echo "<a href='/rfcs/{$num}'>{$num}</a>";
if (next($arr)) {
echo ", ";
}
}?>
<br />
<?php } ?>
<?=$content?>
<?php
// we need to list the rfcs
} else {
$title="RFC List";
$description="A list of Tildeverse RFCs.";
include __DIR__.'/../header.php';
foreach (glob("*.md") as $rfc) {
$rfcs[] = [
"num" => substr(basename($rfc, ".md"), 3),
"yml" => $parser->parse(file_get_contents($rfc))->getYAML(),
];
}
?>
<h1>RFC List</h1>
<ul>
<?php foreach ($rfcs as $rfc) {
if ($rfc["yml"]["status"] !== "Accepted") continue;
?>
<li><a href="/rfcs/<?=$rfc["num"]?>">RFC <?=$rfc["num"]?>: <?=$rfc["yml"]['title']?></a></li>
<?php } ?>
</ul>
<h1>Drafts</h1>
<ul>
<?php foreach ($rfcs as $draft) {
if ($draft["yml"]["status"] === "Accepted") continue;
?>
<li><a href="/rfcs/<?=$draft["num"]?>">Draft <?=$draft["num"]?>: <?=$draft["yml"]["title"]?></a></li>
<?php } ?>
</ul>
<?php } ?>
<?php include __DIR__.'/../footer.php'; ?>