Lexica Botania Online
'c', 'curios.open.desc' => 'k', 'left' => 'a', 'right' => 'w', 'sprint' => 'CTRL' ]; $replacements = array_merge(array_combine(array_map("quote_keys", array_keys($default_keys)), array_values($default_keys)), [ '/\$\((br|p)\)/' => "
", '/\$\(li\)/' => " • ", '/\$\(([0-9a-o])\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$2", '/\$\(thing\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$1", '/\$\(item\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$1", '/\$\(l:([^)]+)\)([^$]+)\$\(\/l\)/' => "$2" ]); $opened_div = false; $current_entry = ''; foreach($json as $key => $value) { $entry_match = match_entry($key); $page_match = match_page($key, $current_entry); if(sizeof($entry_match) > 0) { $current_entry = $entry_match[1]; if($opened_div) echo(''); echo("
$value
"); echo("\n"); $opened_div = true; } if(sizeof($page_match) > 0) { $page = preg_replace(array_keys($replacements), array_values($replacements), $value) . '
'; $no_control = preg_replace('/\$\(.\)/', '', $value); if(strlen($no_control) > 50) { echo($page); echo("\n"); } } } echo('
'); function match($regex, $line) { $matches = array(); preg_match("/$regex/", $line, $matches); return $matches; } function match_entry($key) { return match('botania\.entry\.(\w+)', $key); } function match_page($key, $entry_name) { return match("botania\.page\.$entry_name\d+", $key); } function quote_keys($key) { return "/\\$\\(k:$key\\)/"; } ?>