Module: Katalyst::Content::TableHelper

Included in:
EditorHelper, FrontendHelper
Defined in:
app/helpers/katalyst/content/table_helper.rb

Defined Under Namespace

Classes: TableNormalizer

Instance Method Summary collapse

Instance Method Details

#normalize_content_table(table, heading: true) ⇒ String

Normalize table content and render to an HTML string (un-sanitised).

Parameters:

Returns:

  • (String)

    un-sanitised HTML as text



14
15
16
# File 'app/helpers/katalyst/content/table_helper.rb', line 14

def normalize_content_table(table, heading: true)
  TableNormalizer.new(table, heading:).to_html
end

#sanitize_content_table(content) ⇒ ActiveSupport::SafeBuffer

Sanitize table content and render to an HTML string (un-sanitised).

Parameters:

  • content (String)

    un-sanitised HTML as text

Returns:

  • (ActiveSupport::SafeBuffer)

    sanitised HTML



22
23
24
25
26
27
28
29
# File 'app/helpers/katalyst/content/table_helper.rb', line 22

def sanitize_content_table(content)
  sanitizer.sanitize(
    content,
    tags:       content_table_allowed_tags,
    attributes: content_table_allowed_attributes,
    scrubber:,
  ).html_safe # rubocop:disable Rails/OutputSafety
end