Insert spaces before stripping HTML when inserting search data
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
0d46e4fc3d
commit
8b6c7aa207
@ -24,5 +24,17 @@ defmodule Mobilizon.Service.Formatter.HTML do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Inserts a space before tags closing so that words are not attached once tags stripped
|
||||||
|
|
||||||
|
`<h1>test</h1>next` thing becomes `test next` instead of `testnext`
|
||||||
|
"""
|
||||||
|
@spec strip_tags_and_insert_spaces(String.t()) :: String.t()
|
||||||
|
def strip_tags_and_insert_spaces(html) do
|
||||||
|
html
|
||||||
|
|> String.replace("</", " </")
|
||||||
|
|> strip_tags()
|
||||||
|
end
|
||||||
|
|
||||||
def filter_tags_for_oembed(html), do: Sanitizer.scrub(html, OEmbed)
|
def filter_tags_for_oembed(html), do: Sanitizer.scrub(html, OEmbed)
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ defmodule Mobilizon.Service.Workers.BuildSearch do
|
|||||||
[
|
[
|
||||||
event.id,
|
event.id,
|
||||||
event.title,
|
event.title,
|
||||||
HTML.strip_tags(event.description),
|
HTML.strip_tags_and_insert_spaces(event.description),
|
||||||
get_tags_string(event)
|
get_tags_string(event)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user