Merge pull request 'dev' (#8) from dev into main
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
@@ -231,6 +231,7 @@ def create_plain_text(
|
|||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
lines.extend(_plain_contact_line(contact_email))
|
||||||
|
|
||||||
highlight_articles = _match_highlights(new_articles + edited_articles, highlights)
|
highlight_articles = _match_highlights(new_articles + edited_articles, highlights)
|
||||||
if highlight_articles:
|
if highlight_articles:
|
||||||
@@ -251,7 +252,7 @@ def create_plain_text(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
lines.extend(_plain_editor_tip(editor_tip))
|
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()
|
return "\n".join(lines).strip()
|
||||||
|
|
||||||
if show_new:
|
if show_new:
|
||||||
@@ -268,10 +269,19 @@ def create_plain_text(
|
|||||||
)
|
)
|
||||||
lines.append("")
|
lines.append("")
|
||||||
lines.extend(_plain_editor_tip(editor_tip))
|
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()
|
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]:
|
def _plain_editor_tip(editor_tip: str) -> list[str]:
|
||||||
text = (editor_tip or "").strip()
|
text = (editor_tip or "").strip()
|
||||||
if not text:
|
if not text:
|
||||||
@@ -339,12 +349,18 @@ def create_html(
|
|||||||
if contact_email.strip():
|
if contact_email.strip():
|
||||||
ce = escape(contact_email.strip())
|
ce = escape(contact_email.strip())
|
||||||
contact_html = (
|
contact_html = (
|
||||||
f'Fragen oder ein Themenwunsch? Meldet euch gern beim '
|
f'Fragen oder ein Themenwunsch? '
|
||||||
f'<a href="mailto:{ce}" style="color:{COLOR_TK_ORANGE};text-decoration:underline;">Wiki-Team</a>.'
|
f'<a href="mailto:{ce}" style="color:{COLOR_TK_ORANGE};text-decoration:underline;">Meldet euch gern beim Wiki-Team</a>.'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
contact_html = "Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team."
|
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>
|
return f"""<!DOCTYPE html>
|
||||||
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||||
<head>
|
<head>
|
||||||
@@ -407,6 +423,7 @@ def create_html(
|
|||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{contact_section}
|
||||||
{category_hint}
|
{category_hint}
|
||||||
{highlights_section}
|
{highlights_section}
|
||||||
{body}
|
{body}
|
||||||
@@ -422,7 +439,6 @@ def create_html(
|
|||||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-family:{FONT};font-size:15px;line-height:24px;color:{COLOR_TEXT};">
|
<td style="font-family:{FONT};font-size:15px;line-height:24px;color:{COLOR_TEXT};">
|
||||||
{contact_html}<br><br>
|
|
||||||
Viele Grüße<br>
|
Viele Grüße<br>
|
||||||
Euer Thomas-Krenn-Wiki Team
|
Euer Thomas-Krenn-Wiki Team
|
||||||
</td>
|
</td>
|
||||||
@@ -739,17 +755,19 @@ def create_outlook_html(
|
|||||||
editor_tip_row = _outlook_editor_tip(editor_tip)
|
editor_tip_row = _outlook_editor_tip(editor_tip)
|
||||||
|
|
||||||
if contact_email.strip():
|
if contact_email.strip():
|
||||||
contact_inner = (
|
contact_block = (
|
||||||
f'{_outlook_font("Fragen oder ein Themenwunsch? Meldet euch gern beim Wiki-Team: ", size="1")}'
|
f'<p style="margin:12px 0 20px;">'
|
||||||
f'{_outlook_link(contact_email.strip(), f"mailto:{contact_email.strip()}", color=OUTLOOK_ORANGE, bold=False)}'
|
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:
|
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>
|
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">
|
<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;")}>
|
<td {_outlook_td_attrs(extra_style="padding:20px;")}>
|
||||||
<p style="margin:0 0 8px;">{_outlook_font("Servus,")}</p>
|
<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>
|
<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}
|
{category_block}
|
||||||
{highlights_rows}
|
{highlights_rows}
|
||||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="{OUTLOOK_WHITE}" style="background-color:{OUTLOOK_WHITE} !important;" data-ogsb="{OUTLOOK_WHITE}">
|
<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 →")}
|
{_outlook_cta(WIKI_HOME_URL, "Zum Thomas-Krenn-Wiki →")}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{contact_row}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td {_outlook_td_attrs(extra_style=f"padding:16px 0 0;border-top:1px solid {OUTLOOK_BORDER};")}>
|
<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")}
|
{_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(
|
def _plain_footer(
|
||||||
new_articles: list[dict[str, Any]],
|
new_articles: list[dict[str, Any]],
|
||||||
edited_articles: list[dict[str, Any]],
|
edited_articles: list[dict[str, Any]],
|
||||||
contact_email: str = "",
|
|
||||||
) -> str:
|
) -> str:
|
||||||
total = len(new_articles) + len(edited_articles)
|
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(
|
return "\n".join(
|
||||||
[
|
[
|
||||||
SUBLINE,
|
SUBLINE,
|
||||||
@@ -978,7 +992,6 @@ def _plain_footer(
|
|||||||
"",
|
"",
|
||||||
f"Wiki: {WIKI_HOME_URL}",
|
f"Wiki: {WIKI_HOME_URL}",
|
||||||
"",
|
"",
|
||||||
*contact_lines,
|
|
||||||
SUBLINE,
|
SUBLINE,
|
||||||
"Dieser Newsletter wurde automatisch erstellt und ist nur für den internen",
|
"Dieser Newsletter wurde automatisch erstellt und ist nur für den internen",
|
||||||
f"Gebrauch bei {ORG_NAME} bestimmt.",
|
f"Gebrauch bei {ORG_NAME} bestimmt.",
|
||||||
|
|||||||
Reference in New Issue
Block a user