all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] applied: [PATCH] onlineHelp: try finding - and _ normalized blockid variants
@ 2020-07-21 14:29 Thomas Lamprecht
  0 siblings, 0 replies; only message in thread
From: Thomas Lamprecht @ 2020-07-21 14:29 UTC (permalink / raw)
  To: pbs-devel

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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

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) {
-- 
2.20.1





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-21 14:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 14:29 [pbs-devel] applied: [PATCH] onlineHelp: try finding - and _ normalized blockid variants Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal