]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
onlineHelp: try finding - and _ normalized blockid variants
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 21 Jul 2020 14:28:22 +0000 (16:28 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 21 Jul 2020 14:28:25 +0000 (16:28 +0200)
allows easy support of both separation variants, commonly used in
asciidoc or sphinx.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/Utils.js

index 9a156ddd5d6134472cf773b4c7756b7f4b9b90e4..4be95b2be1de56409207a47be7315a40a360c2d1 100644 (file)
@@ -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) {