mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-24 20:07:48 +02:00
Fix table header.
Make table header vertical only if at least one of the header cells is wider than 2 characters.
This commit is contained in:
parent
1de408ec9a
commit
7fedf63af6
1 changed files with 10 additions and 3 deletions
|
@ -78,12 +78,19 @@ class WikiTable:
|
|||
if not self.collection.column_values:
|
||||
self.collection.column_values = [""]
|
||||
else:
|
||||
make_vertical: bool = False
|
||||
for column_value in self.collection.column_values:
|
||||
if column_value and len(column_value) > 2:
|
||||
make_vertical = True
|
||||
for column_value in self.collection.column_values:
|
||||
text += " ||"
|
||||
if column_value:
|
||||
text += (
|
||||
f" {{{{vert header|{{{{TagValue|"
|
||||
f"{self.collection.column_key}|{column_value}}}}}}}}}"
|
||||
tag: str = (
|
||||
f"{{{{TagValue|"
|
||||
f"{self.collection.column_key}|{column_value}}}}}"
|
||||
)
|
||||
text += " " + (
|
||||
f"{{{{vert header|{tag}}}}}" if make_vertical else tag
|
||||
)
|
||||
text += "\n"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue