Preparations for AdventOfCode section
This commit is contained in:
@@ -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']];
|
||||
|
||||
Reference in New Issue
Block a user