diff --git a/scripts/build.py b/scripts/build.py index f8c3b9f..db5b0a3 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -8,7 +8,7 @@ import markdown -MARKDOWN_EXTENSIONS = ["meta", "attr_list"] +MARKDOWN_EXTENSIONS = ["meta", "md_in_html", "attr_list"] def get_style_rules(): @@ -107,13 +107,6 @@ def get_mail_content(): return html_content, meta -def get_template(): - with open("src/template.html", "r", encoding="utf-8") as html_file: - html_template = html_file.read() - - return html_template - - def get_date(): MONTHS = (None, "janeiro", "fevereiro", "marรงo", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro") @@ -123,7 +116,7 @@ def get_date(): return day, month, year -def get_template_data(config, meta): +def get_props(config, meta): day, month, year = get_date() template_data = { @@ -138,12 +131,8 @@ def get_template_data(config, meta): def get_mail_html (config): - mail_content, meta = get_mail_content() - mail_template = get_template() - template_data = get_template_data(config, meta) - - mail_base = mail_template.format(content = mail_content) - mail_html = mail_base.format(**template_data) + mail_html, meta = get_mail_content() + mail_html = mail_html.format(**get_props(config, meta)) styles_rules = get_style_rules() styled_html = apply_css_rules(mail_html, styles_rules) diff --git a/src/news.md b/src/news.md index 442f520..a54b87f 100644 --- a/src/news.md +++ b/src/news.md @@ -1,13 +1,18 @@ name: PyNews ๐Ÿ“ฐ subject: News of the week -# **Lorem ipsum dolor sit amet** + +{name} - {subject} + +
+ +# Lorem ipsum dolor sit amet consectetur adipiscing elit. Cras in massa accumsan tortor auctor facilisis a eget ligula. Sed mollis eleifend mi vel semper. Phasellus congue, orci tristique porta ultricies, elit neque iaculis magna, sed gravida magna mi sit amet magna. > Sed vitae leo sollicitudin urna tincidunt dictum. Maecenas eget posuere dui. Duis orci felis, vulputate nec fermentum eget, venenatis eu arcu. In aliquet vehicula turpis sed iaculis. -## **Morbi gravida mi ac purus accumsan, non venenatis nisl rutrum** +## Morbi gravida mi ac purus accumsan, non venenatis nisl rutrum **๐Ÿ’ธ ECONOMICS** Pellentesque massa nisi, laoreet vitae placerat ac, ultricies eget elit. Sed facilisis, neque a vehicula tempus, diam nibh tincidunt arcu, in mollis purus neque id sem. Aenean sit amet ante tellus. Vivamus consequat nibh quis egestas tristique. Cras commodo nulla sed tellus congue, eu feugiat enim varius. @@ -16,7 +21,7 @@ Proin nulla arcu, eleifend eget magna et, pulvinar aliquam justo. Vivamus accums Font: [News](https://example.com). -## **In metus est, sodales sit amet tellus id, fringilla gravida lorem** +## In metus est, sodales sit amet tellus id, fringilla gravida lorem **๐Ÿ›๏ธ POLITICS** ![example image](https://images.unsplash.com/photo-1495020689067-958852a7765e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2069&q=80) @@ -36,7 +41,7 @@ Nulla facilisi. Suspendisse finibus vehicula condimentum. Font: [News](https://example.com). -## **Curabitur ac ligula facilisis, gravida enim in, eleifend purus** +## Curabitur ac ligula facilisis, gravida enim in, eleifend purus **๐ŸŒŽ CLIMATE** Quisque imperdiet vel nisi ac tincidunt. Suspendisse felis nibh, finibus vitae luctus quis, cursus nec ligula. Duis venenatis, lectus in pulvinar venenatis, magna massa pulvinar mauris, nec luctus urna magna et sem. Aenean luctus, urna sed eleifend bibendum, augue augue semper augue, non sodales sem ante sed nulla. Vestibulum pellentesque finibus neque, a gravida massa sagittis eu. Praesent fringilla libero sed orci dapibus egestas vehicula vitae leo. Maecenas magna ex, ultricies at aliquam eget, pharetra aliquet arcu. Cras vulputate enim non libero auctor consequat. Suspendisse vulputate interdum sem, a vehicula dui viverra sit amet. Mauris rutrum tincidunt risus eu consequat. Nunc orci ante, eleifend sit amet libero ac, tristique cursus lorem. Cras quis elit nunc. @@ -57,3 +62,5 @@ We always arrive at your inbox around 06:09. **Some email servers are stubborn a

[Unsubscribe]({unsubscribe_link}{user_e-mail}) | [Contact us](https://api.whatsapp.com/send?phone=55912345678) {: style="text-align: center;" } + +
diff --git a/src/template.html b/src/template.html deleted file mode 100644 index 8e1ba57..0000000 --- a/src/template.html +++ /dev/null @@ -1,5 +0,0 @@ -{{name}} - {{subject}} - -
-{content} -