4
4
5
5
6
6
def table (cols : list [str ], rows : list [list [str ]]) -> str :
7
+ def sanitize (content : str ):
8
+ if content is None :
9
+ return ""
10
+ return content .strip ().replace ("\n " , "<br>" ).replace ("|" , "\\ |" )
11
+
7
12
sizes = list (map (len , cols ))
8
13
for row in rows :
9
14
for i , item in enumerate (row ):
10
- item = item . strip ( )
15
+ item = sanitize ( item )
11
16
if len (item ) > sizes [i ]:
12
17
sizes [i ] = len (item )
13
18
14
19
table_md = ""
15
20
for i , col in enumerate (cols ):
16
- table_md += f"| { col .strip ()} { ' ' * (sizes [i ] - len (col .strip ()) + 1 )} "
21
+ content = sanitize (col )
22
+ table_md += f"| { content } { ' ' * (sizes [i ] - len (content ) + 1 )} "
17
23
table_md += "|\n "
18
24
19
25
for i , col in enumerate (cols ):
@@ -22,7 +28,8 @@ def table(cols: list[str], rows: list[list[str]]) -> str:
22
28
23
29
for row in rows :
24
30
for i , item in enumerate (row ):
25
- table_md += f"| { item .strip ()} { ' ' * (sizes [i ] - len (item .strip ()) + 1 )} "
31
+ content = sanitize (item )
32
+ table_md += f"| { content } { ' ' * (sizes [i ] - len (content ) + 1 )} "
26
33
table_md += "|\n "
27
34
return table_md + "\n "
28
35
@@ -197,6 +204,7 @@ def table(cols: list[str], rows: list[list[str]]) -> str:
197
204
"shotgun_entity_type" : "ShotGrid entity types" ,
198
205
"shotgun_permission_group" : "ShotGrid permission groups" ,
199
206
"shotgun_filter" : "ShotGrid filters" ,
207
+ "tank_type" : "Tank types" ,
200
208
}
201
209
if "configuration" in info and info ["configuration" ] is not None :
202
210
readme += "## Configuration\n \n "
@@ -245,6 +253,7 @@ def table(cols: list[str], rows: list[list[str]]) -> str:
245
253
value ,
246
254
)
247
255
)
256
+ print (cols , rows )
248
257
readme += table (cols , rows )
249
258
readme += "\n "
250
259
0 commit comments