diff --git a/src/main/resources/assets/botania/lang/en_us.json b/src/main/resources/assets/botania/lang/en_us.json
index 0727a9305..7e04d5028 100644
--- a/src/main/resources/assets/botania/lang/en_us.json
+++ b/src/main/resources/assets/botania/lang/en_us.json
@@ -2931,7 +2931,7 @@
"botania.entry.bIntro": "An Introduction to Trinkets",
"botania.tagline.bIntro": "Accessories that provide power",
- "botania.page.bIntro0": "$(thing)Trinkets$(0) (also known as $(thing)Curios$(0), $(thing)Baubles$(0), or $(thing)Charms$(0)) are accessories that offer all sorts of different effects when worn.$(p)To equip them, press [$(k:curios.open.desc)$(0)].",
+ "botania.page.bIntro0": "$(thing)Trinkets$(0) (also known as $(thing)Curios$(0), $(thing)Baubles$(0), or $(thing)Charms$(0)) are accessories that offer all sorts of different effects when worn.$(p)To equip them, press [$(k:curios.open.desc)].",
"botania.page.bIntro1": "The $(thing)Curios Screen$(0)",
"botania.page.bIntro2": "Do note that if any other mod uses the $(thing)Curios$(0) system, equipment slots must be shared with that mod's $(thing)Trinkets$(0) as well.",
@@ -3095,7 +3095,7 @@
"botania.entry.dodgeRing": "Ring of Dexterous Motion",
"botania.tagline.dodgeRing": "Sweep to the side to dodge attacks",
- "botania.page.dodgeRing0": "The $(item)Ring of Dexterous Motion$(0) is a handy $(thing)Trinket$(0) for dodging damage during duels. Its wearer can double-tap $(k:left) or $(k:right) to hurl themselves to the side and dodge incoming attacks/mobs.$(p)Dodging has a short cooldown, and burns some of its user's hunger.",
+ "botania.page.dodgeRing0": "The $(item)Ring of Dexterous Motion$(0) is a handy $(thing)Trinket$(0) for dodging damage during duels. Its wearer can double-tap [$(k:left)] or [$(k:right)] to hurl themselves to the side and dodge incoming attacks/mobs.$(p)Dodging has a short cooldown, and burns some of its user's hunger.",
"botania.page.dodgeRing1": "Dexterity bonus",
"botania.entry.invisibilityCloak": "Invisibility Cloak",
diff --git a/web/module/lexicon.php b/web/module/lexicon.php
index 6d70a59d8..4ea01049c 100644
--- a/web/module/lexicon.php
+++ b/web/module/lexicon.php
@@ -21,14 +21,14 @@
'right' => 'w',
'sprint' => 'CTRL'
];
- $replacements = array_merge(array_combine(array_map("quote_keys", array_keys($default_keys)), array_values($default_keys)), [
+ $entry_cache = array();
+ $replacements = [
'/\$\((br|p)\)/' => "
",
'/\$\(li\)/' => " • ",
- '/\$\(([0-9a-o])\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$2",
+ '/\$\(([1-9a-o])\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$2",
'/\$\(thing\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$1",
'/\$\(item\)([^$]+)(?:\$\([0r]?\)|(?=<)|$)/' => "$1",
- '/\$\(l:([^)]+)\)([^$]+)\$\(\/l\)/' => "$2"
- ]);
+ ];
$opened_div = false;
@@ -45,7 +45,11 @@
$opened_div = true;
}
if(sizeof($page_match) > 0) {
- $page = preg_replace(array_keys($replacements), array_values($replacements), $value) . '
';
+ $page = preg_replace_callback('/\$\(k:([^)]*)\)/', 'key_resolve',
+ preg_replace_callback('/\$\(l:([^)]+)\)([^$]+)\$\(\/l\)/', 'link_resolve',
+
+ preg_replace(array_keys($replacements), array_values($replacements),
+ $value))) . '
';
$no_control = preg_replace('/\$\(.\)/', '', $value);
if(strlen($no_control) > 50) {
echo($page);
@@ -69,7 +73,21 @@
function match_page($key, $entry_name) {
return match("botania\.page\.$entry_name\d+", $key);
}
- function quote_keys($key) {
- return "/\\$\\(k:$key\\)/";
+ function key_resolve($match) {
+ global $default_keys; // i'm sorry, i don't know php
+ return (array_key_exists($match[1], $default_keys)
+ ? $default_keys[$match[1]]
+ : "UNKNOWN KEY");
+ }
+ function link_resolve($match) {
+ $link = $match[1];
+ $res = [];
+ if(preg_match('|^\w+/(\w+)$|', $link, $res)) {
+ $entry_name = preg_replace_callback('/_(\w)/', function($repl) {
+ return strtoupper($repl[1]);
+ }, $res[1]);
+ $link = "#$entry_name-fake";
+ }
+ return "$match[2]";
}
?>