newsbuddy
is utility to help generate the bulk of my Friday newsletters which I distribute at work.
The goal is to
- generate an mjml template given a plain-text file containing metadata, welcome message, and links to articles
- invoke the
mjml
command-line tool to generate the HTML file - copy the contents of the HTML file to the clipboard
Most of the tooling will be written in Go. Orchestration will be performed using a Makefile
.
From a .toml
source file, newsbuddy
will generate an .mjml
file according to a defined template. The structure of the newsletter is fairly simple, comprising of a header containing the issue number and date, and a body with the welcome message and articles. Source data is expressed in a TOML file which is parsed and transformed into the output MJML file.
The source file should be in the following format:
[metadata]
title = ""
no = <>
date = ""
welcome = """
""" # Multiline welcome message
[[articles]]
url = ""
type = "<TEXT | VIDEO>"
cat = "<GENERAL | DEV | RECIPE>"
[[articles]]
url = ""
type = "<TEXT | VIDEO>"
cat = "<GENERAL | DEV | RECIPE>"
# Add as many articles as you wish!
template.mjml
contains the empty template used for the newsletter. We use Go's text/template
package to populate the template.
- Decide on a config file structure - this is used to define the metadata, welcome message, and links for a specific issue
- Implement text parser for the above
- Add
Makefile
to orchestrate template generation and invokingmjml