From 6f6f8c26087cd5b963bf5bb3efade769656610a6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 26 Sep 2019 16:49:49 +0200 Subject: [PATCH] Remove unneeded Markdown converter (earmark) Signed-off-by: Thomas Citharel --- lib/mobilizon_web/api/utils.ex | 11 ----------- lib/service/export/feed.ex | 28 +++++++++++----------------- mix.exs | 1 - 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/lib/mobilizon_web/api/utils.ex b/lib/mobilizon_web/api/utils.ex index a6b55b25d..6e98453f3 100644 --- a/lib/mobilizon_web/api/utils.ex +++ b/lib/mobilizon_web/api/utils.ex @@ -115,17 +115,6 @@ defmodule MobilizonWeb.API.Utils do |> Formatter.linkify(options) end - # @doc """ - # Formatting text to markdown. - # """ - # def format_input(text, "text/markdown", options) do - # text - # |> Formatter.mentions_escape(options) - # |> Earmark.as_html!() - # |> Formatter.linkify(options) - # |> Formatter.html_escape("text/html") - # end - def make_report_content_text(nil), do: {:ok, nil} def make_report_content_text(comment) do diff --git a/lib/service/export/feed.ex b/lib/service/export/feed.ex index ce33e73bb..ef556aac5 100644 --- a/lib/service/export/feed.ex +++ b/lib/service/export/feed.ex @@ -101,25 +101,19 @@ defmodule Mobilizon.Service.Export.Feed do defp get_entry(%Event{} = event) do description = event.description || "" - case Earmark.as_html(description) do - {:ok, html, []} -> - entry = - Entry.new(event.url, event.publish_at || event.inserted_at, event.title) - |> Entry.link(event.url, rel: "alternate", type: "text/html") - |> Entry.content({:cdata, html}, type: "html") - |> Entry.published(event.publish_at || event.inserted_at) + entry = + Entry.new(event.url, event.publish_at || event.inserted_at, event.title) + |> Entry.link(event.url, rel: "alternate", type: "text/html") + |> Entry.content({:cdata, description}, type: "html") + |> Entry.published(event.publish_at || event.inserted_at) - # Add tags - entry = - event.tags - |> Enum.uniq() - |> Enum.reduce(entry, fn tag, acc -> Entry.category(acc, tag.slug, label: tag.title) end) + # Add tags + entry = + event.tags + |> Enum.uniq() + |> Enum.reduce(entry, fn tag, acc -> Entry.category(acc, tag.slug, label: tag.title) end) - Entry.build(entry) - - {:error, _html, error_messages} -> - Logger.error("Unable to produce HTML for Markdown", details: inspect(error_messages)) - end + Entry.build(entry) end @spec fetch_events_from_token(String.t()) :: String.t() diff --git a/mix.exs b/mix.exs index cf6233cfb..99f2b8179 100644 --- a/mix.exs +++ b/mix.exs @@ -88,7 +88,6 @@ defmodule Mobilizon.Mixfile do {:plug_cowboy, "~> 2.0"}, {:atomex, "0.3.0"}, {:cachex, "~> 3.1"}, - {:earmark, "~> 1.4.0"}, {:geohax, "~> 0.3.0"}, {:mogrify, "~> 0.7.2"}, {:auto_linker,