dev #8

Merged
smueller merged 2 commits from dev into main 2026-07-07 14:05:50 +00:00

View File

@@ -231,6 +231,7 @@ def create_plain_text(
"",
]
)
lines.extend(_plain_contact_line(contact_email))
highlight_articles = _match_highlights(new_articles + edited_articles, highlights)
if highlight_articles:
@@ -251,7 +252,7 @@ def create_plain_text(
]
)
lines.extend(_plain_editor_tip(editor_tip))
lines.append(_plain_footer(new_articles, edited_articles, contact_email))
lines.append(_plain_footer(new_articles, edited_articles))
return "\n".join(lines).strip()
if show_new:
@@ -268,10 +269,19 @@ def create_plain_text(
)
lines.append("")
lines.extend(_plain_editor_tip(editor_tip))
lines.append(_plain_footer(new_articles, edited_articles, contact_email))
lines.append(_plain_footer(new_articles, edited_articles))
return "\n".join(lines).strip()
def _plain_contact_line(contact_email: str) -> list[str]:
if contact_email.strip():
return [
f"Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team ({contact_email.strip()}).",
"",
]
return ["Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team.", ""]
def _plain_editor_tip(editor_tip: str) -> list[str]:
text = (editor_tip or "").strip()
if not text:
@@ -339,12 +349,18 @@ def create_html(
if contact_email.strip():
ce = escape(contact_email.strip())
contact_html = (
f'Fragen oder ein Themenwunsch? Meldet euch gern beim '
f'<a href="mailto:{ce}" style="color:{COLOR_TK_ORANGE};text-decoration:underline;">Wiki-Team</a>.'
f'Fragen oder ein Themenwunsch? '
f'<a href="mailto:{ce}" style="color:{COLOR_TK_ORANGE};text-decoration:underline;">Meldet euch gern beim Wiki-Team</a>.'
)
else:
contact_html = "Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team."
contact_section = (
f'<tr><td style="padding:16px 32px 24px 32px;" class="mobile-padding">'
f'<p style="margin:8px 0 0;font-family:{FONT};font-size:15px;line-height:24px;color:{COLOR_TEXT};">{contact_html}</p>'
f"</td></tr>"
)
return f"""<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
@@ -407,6 +423,7 @@ def create_html(
</table>
</td>
</tr>
{contact_section}
{category_hint}
{highlights_section}
{body}
@@ -422,7 +439,6 @@ def create_html(
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="font-family:{FONT};font-size:15px;line-height:24px;color:{COLOR_TEXT};">
{contact_html}<br><br>
Viele Grüße<br>
Euer Thomas-Krenn-Wiki Team
</td>
@@ -739,17 +755,19 @@ def create_outlook_html(
editor_tip_row = _outlook_editor_tip(editor_tip)
if contact_email.strip():
contact_inner = (
f'{_outlook_font("Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team: ", size="1")}'
f'{_outlook_link(contact_email.strip(), f"mailto:{contact_email.strip()}", color=OUTLOOK_ORANGE, bold=False)}'
contact_block = (
f'<p style="margin:12px 0 20px;">'
f'{_outlook_font("Fragen oder ein Themenwunsch? ", size="1")}'
f'{_outlook_link("Meldet euch gern beim Wiki-Team", f"mailto:{contact_email.strip()}", color=OUTLOOK_ORANGE, bold=False, size="1")}'
f'{_outlook_font(".", size="1")}'
f"</p>"
)
contact_row = f"""<tr>
<td {_outlook_td_attrs(extra_style="padding:12px 0 0;")}>
{contact_inner}
</td>
</tr>"""
else:
contact_row = ""
contact_block = (
f'<p style="margin:12px 0 20px;">'
f'{_outlook_font("Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team.", size="1")}'
f"</p>"
)
return f"""<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word">
@@ -799,6 +817,7 @@ def create_outlook_html(
<td {_outlook_td_attrs(extra_style="padding:20px;")}>
<p style="margin:0 0 8px;">{_outlook_font("Servus,")}</p>
<p style="margin:0 0 16px;">{_outlook_font(f"hier ist deine Übersicht mit den neuesten Beiträgen aus dem Thomas-Krenn-Wiki vom {period_start} bis {period_end}.")}</p>
{contact_block}
{category_block}
{highlights_rows}
<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="{OUTLOOK_WHITE}" style="background-color:{OUTLOOK_WHITE} !important;" data-ogsb="{OUTLOOK_WHITE}">
@@ -810,7 +829,6 @@ def create_outlook_html(
{_outlook_cta(WIKI_HOME_URL, "Zum Thomas-Krenn-Wiki →")}
</td>
</tr>
{contact_row}
<tr>
<td {_outlook_td_attrs(extra_style=f"padding:16px 0 0;border-top:1px solid {OUTLOOK_BORDER};")}>
{_outlook_font(f"Automatisch erstellter interner Newsletter · Nur für den Gebrauch bei {ORG_NAME}", color=OUTLOOK_MUTED, size="1")}
@@ -961,12 +979,8 @@ def _plain_item(idx: int, item: dict[str, Any], display: DisplayOptions) -> list
def _plain_footer(
new_articles: list[dict[str, Any]],
edited_articles: list[dict[str, Any]],
contact_email: str = "",
) -> str:
total = len(new_articles) + len(edited_articles)
contact_lines = []
if contact_email.strip():
contact_lines = [f"Fragen oder ein Themenwunsch? E-Mail an das Wiki-Team: {contact_email.strip()}", ""]
return "\n".join(
[
SUBLINE,
@@ -978,7 +992,6 @@ def _plain_footer(
"",
f"Wiki: {WIKI_HOME_URL}",
"",
*contact_lines,
SUBLINE,
"Dieser Newsletter wurde automatisch erstellt und ist nur für den internen",
f"Gebrauch bei {ORG_NAME} bestimmt.",