From 4eee62a475b9811339cc6248cd52cd4a9f37bdaf Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Thu, 12 Dec 2024 16:27:44 +0000 Subject: [PATCH] Switch to header structure for different levels of interests - Start at h4 to allow for the structure of the page. --- pyscraper/regmem/commons/api_models.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pyscraper/regmem/commons/api_models.py b/pyscraper/regmem/commons/api_models.py index d952dad1..11dbc8b4 100644 --- a/pyscraper/regmem/commons/api_models.py +++ b/pyscraper/regmem/commons/api_models.py @@ -42,8 +42,11 @@ def multi_to_camel(value: str) -> AliasChoices: interest_template = Template( """
-

{{ interest.summary|e }}

- + {% if is_child %} +
{{ interest.summary|e }}
+ {% else %} +

{{ interest.summary|e }}

+ {% endif %} {% if interest.child_items %} -

Specific work or payments

+
Specific work or payments
{% for child in interest.child_items %} - {{child.to_html()}} + {{ child.to_html(is_child=True) }} {% endfor %}
{% endif %} @@ -212,8 +215,8 @@ def last_updated_date(self) -> Optional[date]: return self.updated_date[-1] return None - def to_html(self) -> str: - result = interest_template.render(interest=self) + def to_html(self, is_child: bool = False) -> str: + result = interest_template.render(interest=self, is_child=is_child) # remove blank lines result = "\n".join([x for x in result.split("\n") if x.strip()])