summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorrebortg <github@ghlr.de>2020-12-08 18:59:17 +0100
committerrebortg <github@ghlr.de>2020-12-08 18:59:17 +0100
commit41423f984ef097c0df6fdda4095bcbbb9d08d056 (patch)
tree0023090e926a55c37b2ba64ec14a5d2586aa4e48 /docs
parent710052003d25b3cf405f68b415716451707c6f61 (diff)
downloadvyos-documentation-41423f984ef097c0df6fdda4095bcbbb9d08d056.tar.gz
vyos-documentation-41423f984ef097c0df6fdda4095bcbbb9d08d056.zip
coverage: improve regex
Diffstat (limited to 'docs')
-rw-r--r--docs/_ext/vyos.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/docs/_ext/vyos.py b/docs/_ext/vyos.py
index 4a974b46..7861c8a2 100644
--- a/docs/_ext/vyos.py
+++ b/docs/_ext/vyos.py
@@ -430,15 +430,30 @@ class CfgCmdDirective(CmdDirective):
custom_class = 'cfg'
-def strip_cmd(cmd):
+def strip_cmd(cmd, debug=False):
+ if debug:
+ print("")
+ print(cmd)
cmd = re.sub('set','',cmd)
- cmd = re.sub('\s\|\s','',cmd)
+ if debug:
+ print(cmd)
+ #while " | " in cmd:
+ cmd = re.sub('\s+\|\s+','',cmd)
+ if debug:
+ print(cmd)
cmd = re.sub('<\S*>','',cmd)
+ if debug:
+ print(cmd)
cmd = re.sub('\[\S\]','',cmd)
+ if debug:
+ print(cmd)
cmd = re.sub('\s+','',cmd)
+ if debug:
+ print(cmd)
+ print("")
return cmd
-def build_row(app, fromdocname, rowdata):
+def build_row(app, fromdocname, rowdata):
row = nodes.row()
for cell in rowdata:
entry = nodes.entry()
@@ -480,7 +495,11 @@ def process_coverage(app, fromdocname, doccmd, xmlcmd, cli_type):
coverage_item['doccmd_item'] = cmd
coverage_item['indocs'] = True
int_docs += 1
+
coverage_list[strip_cmd(cmd['cmd'])] = dict(coverage_item)
+
+
+ #print(coverage_list.keys())
for cmd in xmlcmd:
@@ -502,11 +521,6 @@ def process_coverage(app, fromdocname, doccmd, xmlcmd, cli_type):
int_xml += 1
coverage_list[strip] = dict(coverage_item)
else:
- #print("===BEGIN===")
- #print(cmd)
- #print(coverage_list[strip])
- #print(strip)
- #print("===END====")
coverage_list[strip]['xmlcmd'] = cmd['cmd']
coverage_list[strip]['xmlcmd_item'] = cmd
coverage_list[strip]['inxml'] = True