mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
utils/doc: Add support for dicts to format literal
Now supports cleaner outputing of python dicts
This commit is contained in:
parent
f463060870
commit
3ddb1272aa
@ -263,6 +263,9 @@ def format_literal(lit):
|
|||||||
return '``\'{}\'``'.format(lit)
|
return '``\'{}\'``'.format(lit)
|
||||||
elif hasattr(lit, 'pattern'): # regex
|
elif hasattr(lit, 'pattern'): # regex
|
||||||
return '``r\'{}\'``'.format(lit.pattern)
|
return '``r\'{}\'``'.format(lit.pattern)
|
||||||
|
elif isinstance(lit, dict):
|
||||||
|
content = indent(',\n'.join("{}: {}".format(key,val) for (key,val) in lit.iteritems()))
|
||||||
|
return '::\n\n{}'.format(indent('{{\n{}\n}}'.format(content)))
|
||||||
else:
|
else:
|
||||||
return '``{}``'.format(lit)
|
return '``{}``'.format(lit)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user