]> git.proxmox.com Git - proxmox-backup.git/commitdiff
scanrefs: match all instances of 'onlineHelp' in js files
authorOguz Bektas <o.bektas@proxmox.com>
Mon, 5 Oct 2020 14:57:10 +0000 (16:57 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Oct 2020 15:00:49 +0000 (17:00 +0200)
previously it looked for the first instance. this behavior
became an issue while trying to add multiple onlineHelp buttons

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
docs/_ext/proxmox-scanrefs.py

index dd88f462da268a68a5281c7db0bdc91ff974be86..58176fe5719b55a38e50689e4bacebf7a9d785ab 100644 (file)
@@ -44,12 +44,13 @@ def scan_extjs_files(wwwdir="../www"): # a bit rough i know, but we can optimize
                 js_files.append(os.path.join(root, filename))
     for js_file in js_files:
         fd = open(js_file).read()
-        match = re.search("onlineHelp:\s*[\'\"](.*?)[\'\"]", fd) # match object is tuple
-        if match:
-            anchor = match.groups()[0]
+        allmatch = re.findall("onlineHelp:\s*[\'\"](.*?)[\'\"]", fd, re.M)
+        for match in allmatch:
+            anchor = match
             anchor = re.sub('_', '-', anchor) # normalize labels
             logger.info("found onlineHelp: {} in {}".format(anchor, js_file))
             used_anchors.append(anchor)
+
     return used_anchors