mirror of
https://github.com/myned/modufur.git
synced 2024-12-23 22:27:27 +00:00
Add formatting switches for different use cases
This commit is contained in:
parent
a93cd158fa
commit
41a4fb9055
1 changed files with 12 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
|||
def tostring(i, *, order=None):
|
||||
def tostring(i, *, order=None, newline=False):
|
||||
o = ''
|
||||
if i:
|
||||
for v in i:
|
||||
o += v + ' '
|
||||
o += v + (' ' if newline is False else '\n')
|
||||
o = o[:-1]
|
||||
elif order:
|
||||
o += order
|
||||
|
@ -20,11 +20,17 @@ def tostring_commas(i):
|
|||
return ''
|
||||
|
||||
|
||||
def dict_tostring(i):
|
||||
def dict_tostring(i, f=True):
|
||||
o = ''
|
||||
if i:
|
||||
for k, v in i.items():
|
||||
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
||||
|
||||
if f:
|
||||
if i:
|
||||
for k, v in i.items():
|
||||
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
||||
else:
|
||||
if i:
|
||||
for k, v in i.items():
|
||||
o += k + ': ```' + tostring(v, newline=True) + '```\n'
|
||||
return o
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue