logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

search_indexing.ex (721B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.HTML.Scrubber.SearchIndexing do
  5. @moduledoc """
  6. An HTML scrubbing policy that scrubs things for searching.
  7. """
  8. require FastSanitize.Sanitizer.Meta
  9. alias FastSanitize.Sanitizer.Meta
  10. # Explicitly remove mentions
  11. def scrub({:a, attrs, children}) do
  12. if(Enum.any?(attrs, fn {att, val} -> att == "class" and String.contains?(val, "mention") end),
  13. do: nil,
  14. # Strip the tag itself, leave only children (text, presumably)
  15. else: children
  16. )
  17. end
  18. Meta.strip_comments()
  19. Meta.strip_everything_not_covered()
  20. end