diff --git a/bin/add_newsletter b/bin/add_newsletter index c437800..e5a8234 100755 --- a/bin/add_newsletter +++ b/bin/add_newsletter @@ -57,8 +57,9 @@ IO.puts("|- Adding issue #{to_string(next)}") IO.puts("|- Fetching HTML") %{body: body} = Req.get!(url) - -[title] = Floki.parse_document!(body) |> Floki.attribute("meta[property='og:title']", "content") +parsed_html = Floki.parse_document!(body) +[title] = Floki.attribute(parsed_html, "meta[property='og:title']", "content") +cleansed_html = Floki.filter_out(parsed_html, "meta[name='robots']") date = if opts[:date] && opts[:date] =~ ~r/^\d{4}-\d{2}-\d{2}$/ do opts[:date] @@ -77,6 +78,6 @@ aliases: """ IO.puts(["|- Writing ", Path.relative_to(html_name, root)]) -File.write!(html_name, [data, "\n", body]) +File.write!(html_name, [data, "\n", Floki.raw_html(cleansed_html, pretty: true)]) IO.puts([IO.ANSI.green(), "|- Done!", IO.ANSI.default_color()]) diff --git a/content/newsletter/2021-04-22-welcome-to-the-nerves-newsletter.html b/content/newsletter/2021-04-22-welcome-to-the-nerves-newsletter.html index 0d6f44f..f248091 100644 --- a/content/newsletter/2021-04-22-welcome-to-the-nerves-newsletter.html +++ b/content/newsletter/2021-04-22-welcome-to-the-nerves-newsletter.html @@ -462,7 +462,7 @@ @import url(https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +