mirror of
https://github.com/vyos/vyos-documentation.git
synced 2025-10-26 08:41:46 +01:00
coverage: improve regex
This commit is contained in:
parent
710052003d
commit
41423f984e
@ -430,12 +430,27 @@ class CfgCmdDirective(CmdDirective):
|
|||||||
custom_class = 'cfg'
|
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('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)
|
cmd = re.sub('<\S*>','',cmd)
|
||||||
|
if debug:
|
||||||
|
print(cmd)
|
||||||
cmd = re.sub('\[\S\]','',cmd)
|
cmd = re.sub('\[\S\]','',cmd)
|
||||||
|
if debug:
|
||||||
|
print(cmd)
|
||||||
cmd = re.sub('\s+','',cmd)
|
cmd = re.sub('\s+','',cmd)
|
||||||
|
if debug:
|
||||||
|
print(cmd)
|
||||||
|
print("")
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
def build_row(app, fromdocname, rowdata):
|
def build_row(app, fromdocname, rowdata):
|
||||||
@ -480,8 +495,12 @@ def process_coverage(app, fromdocname, doccmd, xmlcmd, cli_type):
|
|||||||
coverage_item['doccmd_item'] = cmd
|
coverage_item['doccmd_item'] = cmd
|
||||||
coverage_item['indocs'] = True
|
coverage_item['indocs'] = True
|
||||||
int_docs += 1
|
int_docs += 1
|
||||||
|
|
||||||
coverage_list[strip_cmd(cmd['cmd'])] = dict(coverage_item)
|
coverage_list[strip_cmd(cmd['cmd'])] = dict(coverage_item)
|
||||||
|
|
||||||
|
|
||||||
|
#print(coverage_list.keys())
|
||||||
|
|
||||||
for cmd in xmlcmd:
|
for cmd in xmlcmd:
|
||||||
|
|
||||||
strip = strip_cmd(cmd['cmd'])
|
strip = strip_cmd(cmd['cmd'])
|
||||||
@ -502,11 +521,6 @@ def process_coverage(app, fromdocname, doccmd, xmlcmd, cli_type):
|
|||||||
int_xml += 1
|
int_xml += 1
|
||||||
coverage_list[strip] = dict(coverage_item)
|
coverage_list[strip] = dict(coverage_item)
|
||||||
else:
|
else:
|
||||||
#print("===BEGIN===")
|
|
||||||
#print(cmd)
|
|
||||||
#print(coverage_list[strip])
|
|
||||||
#print(strip)
|
|
||||||
#print("===END====")
|
|
||||||
coverage_list[strip]['xmlcmd'] = cmd['cmd']
|
coverage_list[strip]['xmlcmd'] = cmd['cmd']
|
||||||
coverage_list[strip]['xmlcmd_item'] = cmd
|
coverage_list[strip]['xmlcmd_item'] = cmd
|
||||||
coverage_list[strip]['inxml'] = True
|
coverage_list[strip]['inxml'] = True
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user