1
0

Preparations for AdventOfCode section

This commit is contained in:
2019-11-02 20:19:34 +01:00
parent e12d410015
commit e00edb7425
106 changed files with 19401 additions and 11 deletions

View File

@@ -6,10 +6,10 @@ class Blog
{
$all = require (__DIR__ . '/../statics/blog/__all.php');
return array_map('self::completeSingle', $all);
return array_map('self::readSingle', $all);
}
private static function completeSingle($d)
private static function readSingle($d)
{
if ($d['cat']==='blog')
$d['url'] = "/blog/" . $d['id'] . "/" . destructiveUrlEncode($d['title']);
@@ -20,6 +20,8 @@ class Blog
$d['file_fragment'] = __DIR__ . '/../statics/blog/' . $d['fragment'];
if (!array_key_exists('extras', $d)) $d['extras'] = [];
return $d;
}
@@ -66,6 +68,12 @@ class Blog
// aok
} else if ($post['type'] === 'aoc') {
if (!array_key_exists('aoc:year', $post['extras'])) return ['result'=>'err', 'message' => 'AdventOfCode metadata [aoc:year] missing: ' . $post['title']];
// aok
} else {
return ['result'=>'err', 'message' => 'Unknown type ' . $post['type']];