From: Thomas Lamprecht Date: Tue, 21 Jul 2020 14:28:22 +0000 (+0200) Subject: onlineHelp: try finding - and _ normalized blockid variants X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7f56fd0cb0995058c79cc4c82a459d452a3988c2;p=proxmox-widget-toolkit.git onlineHelp: try finding - and _ normalized blockid variants allows easy support of both separation variants, commonly used in asciidoc or sphinx. Signed-off-by: Thomas Lamprecht --- diff --git a/src/Utils.js b/src/Utils.js index 9a156dd..4be95b2 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -793,7 +793,17 @@ utilities: { throw "no global OnlineHelpInfo map declared"; } - return helpMap[section]; + if (helpMap[section]) { + return helpMap[section]; + } + // try to normalize - and _ separators, to support asciidoc and sphinx + // references at the same time. + let section_minus_normalized = section.replace(/_/, '-'); + if (helpMap[section_minus_normalized]) { + return helpMap[section_minus_normalized]; + } + let section_underscore_normalized = section.replace(/-/, '_'); + return helpMap[section_underscore_normalized]; }, get_help_link: function(section) {