Make OD-API for consistent for constraints, LHS patterns, RHS actions.
This commit is contained in:
parent
1eb8a84553
commit
9c68b288c1
8 changed files with 108 additions and 79 deletions
|
|
@ -4,14 +4,16 @@ def indent(multiline_string, how_much):
|
|||
lines = multiline_string.split('\n')
|
||||
return '\n'.join([' '*how_much+l for l in lines])
|
||||
|
||||
def display_value(val: any, type_name: str, indentation=0):
|
||||
def display_value(val: any, type_name: str, indentation=0, newline_character='\n'):
|
||||
if type_name == "ActionCode":
|
||||
if '\n' in val:
|
||||
return '```\n'+indent(val, indentation+4)+'\n'+' '*indentation+'```'
|
||||
orig = '```\n'+indent(val, indentation+4)+'\n'+' '*indentation+'```'
|
||||
escaped = orig.replace('\n', newline_character)
|
||||
return escaped
|
||||
else:
|
||||
return '`'+val+'`'
|
||||
elif type_name == "String":
|
||||
return '"'+val+'"'
|
||||
return '"'+val+'"'.replace('\n', newline_character)
|
||||
elif type_name == "Integer" or type_name == "Boolean":
|
||||
return str(val)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue