mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-27 05:19:00 +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:
|
if not self.collection.column_values:
|
||||||
self.collection.column_values = [""]
|
self.collection.column_values = [""]
|
||||||
else:
|
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:
|
for column_value in self.collection.column_values:
|
||||||
text += " ||"
|
text += " ||"
|
||||||
if column_value:
|
if column_value:
|
||||||
text += (
|
tag: str = (
|
||||||
f" {{{{vert header|{{{{TagValue|"
|
f"{{{{TagValue|"
|
||||||
f"{self.collection.column_key}|{column_value}}}}}}}}}"
|
f"{self.collection.column_key}|{column_value}}}}}"
|
||||||
|
)
|
||||||
|
text += " " + (
|
||||||
|
f"{{{{vert header|{tag}}}}}" if make_vertical else tag
|
||||||
)
|
)
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue