mirror of
https://codeberg.org/mclemens/esm2markdown.git
synced 2024-09-28 01:56:04 -04:00
Implemented toc, code indent corrections
This commit is contained in:
parent
7c62db1889
commit
da1aebd61c
@ -34,6 +34,9 @@ level3 = " * "
|
||||
# Configure here if Rules should be alphabetically sorted or not
|
||||
sort_rules = True
|
||||
|
||||
# Configure TOC generation
|
||||
toc = True
|
||||
|
||||
# Generates a line containing linebreaks, indented lists, styles etc.
|
||||
def line(level,key,value):
|
||||
|
||||
@ -84,6 +87,11 @@ def main(xmlfile,outfile):
|
||||
else:
|
||||
root = etree.parse(xmlfile)
|
||||
|
||||
if toc:
|
||||
file.write("\n# Correlation Rule Overview\n\n")
|
||||
for rule in root.getiterator('rule'):
|
||||
file.write(line(1,rule.findtext('message'),"N/A"))
|
||||
|
||||
for rule in root.getiterator('rule'):
|
||||
# Get CDATA
|
||||
text = rule.findtext('text')
|
||||
@ -149,8 +157,10 @@ def main(xmlfile,outfile):
|
||||
if str(e.tag) == 'singleFilterComponent':
|
||||
t = e.get('type')
|
||||
if str(e.tag) == 'filterData':
|
||||
if (e.get('name') == "operator"): o = e.get('value')
|
||||
if (e.get('name') == "value"): v = e.get('value')
|
||||
if (e.get('name') == "operator"):
|
||||
o = e.get('value')
|
||||
if (e.get('name') == "value"):
|
||||
v = e.get('value')
|
||||
if o and v and t:
|
||||
file.write(line(2,"Filter Component","N/A"))
|
||||
file.write(line(3,"Condition:","'" + t + "' " + o + " '" + v + "'"))
|
||||
|
Loading…
Reference in New Issue
Block a user