Merge branch 'deps/remove-earmark' into 'master'

Remove unneeded Markdown converter (earmark)

Closes #172

See merge request framasoft/mobilizon!201
This commit is contained in:
Thomas Citharel 2019-09-26 17:10:19 +02:00
commit 6cb250ffee
3 changed files with 11 additions and 29 deletions

View File

@ -115,17 +115,6 @@ defmodule MobilizonWeb.API.Utils do
|> Formatter.linkify(options) |> Formatter.linkify(options)
end 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(nil), do: {:ok, nil}
def make_report_content_text(comment) do def make_report_content_text(comment) do

View File

@ -101,25 +101,19 @@ defmodule Mobilizon.Service.Export.Feed do
defp get_entry(%Event{} = event) do defp get_entry(%Event{} = event) do
description = event.description || "" description = event.description || ""
case Earmark.as_html(description) do entry =
{:ok, html, []} -> Entry.new(event.url, event.publish_at || event.inserted_at, event.title)
entry = |> Entry.link(event.url, rel: "alternate", type: "text/html")
Entry.new(event.url, event.publish_at || event.inserted_at, event.title) |> Entry.content({:cdata, description}, type: "html")
|> Entry.link(event.url, rel: "alternate", type: "text/html") |> Entry.published(event.publish_at || event.inserted_at)
|> Entry.content({:cdata, html}, type: "html")
|> Entry.published(event.publish_at || event.inserted_at)
# Add tags # Add tags
entry = entry =
event.tags event.tags
|> Enum.uniq() |> Enum.uniq()
|> Enum.reduce(entry, fn tag, acc -> Entry.category(acc, tag.slug, label: tag.title) end) |> Enum.reduce(entry, fn tag, acc -> Entry.category(acc, tag.slug, label: tag.title) end)
Entry.build(entry) Entry.build(entry)
{:error, _html, error_messages} ->
Logger.error("Unable to produce HTML for Markdown", details: inspect(error_messages))
end
end end
@spec fetch_events_from_token(String.t()) :: String.t() @spec fetch_events_from_token(String.t()) :: String.t()

View File

@ -88,7 +88,6 @@ defmodule Mobilizon.Mixfile do
{:plug_cowboy, "~> 2.0"}, {:plug_cowboy, "~> 2.0"},
{:atomex, "0.3.0"}, {:atomex, "0.3.0"},
{:cachex, "~> 3.1"}, {:cachex, "~> 3.1"},
{:earmark, "~> 1.4.0"},
{:geohax, "~> 0.3.0"}, {:geohax, "~> 0.3.0"},
{:mogrify, "~> 0.7.2"}, {:mogrify, "~> 0.7.2"},
{:auto_linker, {:auto_linker,