'; $hrpos = strrpos($parsed, $hrtag); if ($hrpos !== false) { return [ substr($parsed, 0, $hrpos), substr($parsed, $hrpos + strlen($hrtag)) ]; } return [$parsed, '']; } function kvhead($page) { $raw = file_get_contents("src/" . $page["path"]); preg_match('/^---\n\s*(.*?)\s*\n---\n/s', $raw, $matches); if (!empty($matches[1])) { foreach (explode("\n", $matches[1]) as $line) { $line = trim($line); if ($line === '') continue; $kv = explode(' ', $line, 2); if (empty($kv[1])) $page[$kv[0]] = true; else $page[$kv[0]] = $kv[1]; } } return $page; } ?>