Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left align table in PDF #66

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,23 @@ def translate(geol_code, fallback, lang="FR"):

return msg


# Custom sort key
def custom_sort_key(item):
key, _ = item
if key in ["999997", "999998"]:
return float('inf') # Ensure "999997" and "999998" come last
return float("inf") # Ensure "999997" and "999998" come last
return int(key)



def get_coded_values(domain_name):
if domain_name in domains.keys():
domain = domains.get(domain_name)
# print(f" {name}, {att_type} , {domain_name}")
if domain.get("type") == "CodedValue":
coded_values = domain.get("codedValues")
# Sort the list using the custom key
return dict(sorted(coded_values.items(), key=custom_sort_key))

return dict(sorted(coded_values.items(), key=custom_sort_key))

return {}

Expand Down
6 changes: 6 additions & 0 deletions templates/metadata.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ keywords:
subject: {{_("Geologische Landesaufnahme der Schweiz")}}
lang: {{lang}}

# Custom LaTeX headers
# Left-align all tables
header-includes: |
\usepackage[margins=raggedright]{floatrow}


fontsize: 9pt
geometry: "left=3cm,right=2cm,top=3cm,bottom=3cm"
colorlinks: true
Expand Down