public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH] onlineHelp: try finding - and _ normalized blockid variants
Date: Tue, 21 Jul 2020 16:29:31 +0200	[thread overview]
Message-ID: <20200721142931.23037-1-t.lamprecht@proxmox.com> (raw)

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





                 reply	other threads:[~2020-07-21 14:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200721142931.23037-1-t.lamprecht@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal