fix: allow html_to_text to receive nil, e.g. for empty event descriptions
Fixes https://git.potsda.mn/potsda.mn/mobilizon/issues/34 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
committed by
Thomas Citharel
parent
987c5b59d3
commit
5030b755a0
@@ -41,7 +41,9 @@ defmodule Mobilizon.Service.Formatter.HTML do
|
||||
|
||||
def strip_tags_and_insert_spaces(html), do: html
|
||||
|
||||
@spec html_to_text(String.t()) :: String.t()
|
||||
@spec html_to_text(String.t() | nil) :: String.t() | nil
|
||||
def html_to_text(nil), do: nil
|
||||
|
||||
def html_to_text(html) do
|
||||
html
|
||||
|> String.replace(~r/<li>/, "\\g{1}- ", global: true)
|
||||
|
||||
Reference in New Issue
Block a user