Sha256: b883d1e33de8c049c303d78de9b14ac39b936f98dc028878c856c4e9debe38f7

Contents?: true

Size: 1.77 KB

Versions: 17

Compression:

Stored size: 1.77 KB

Contents

# frozen_string_literal: true

require "set"

module Loofah
  module Elements
    STRICT_BLOCK_LEVEL_HTML4 = Set.new([
      "address",
      "blockquote",
      "center",
      "dir",
      "div",
      "dl",
      "fieldset",
      "form",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6",
      "hr",
      "isindex",
      "menu",
      "noframes",
      "noscript",
      "ol",
      "p",
      "pre",
      "table",
      "ul",
    ])

    # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
    STRICT_BLOCK_LEVEL_HTML5 = Set.new([
      "address",
      "article",
      "aside",
      "blockquote",
      "canvas",
      "dd",
      "div",
      "dl",
      "dt",
      "fieldset",
      "figcaption",
      "figure",
      "footer",
      "form",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6",
      "header",
      "hgroup",
      "hr",
      "li",
      "main",
      "nav",
      "noscript",
      "ol",
      "output",
      "p",
      "pre",
      "section",
      "table",
      "tfoot",
      "ul",
      "video",
    ])

    # The following elements may also be considered block-level
    # elements since they may contain block-level elements
    LOOSE_BLOCK_LEVEL = Set.new([
      "dd",
      "dt",
      "frameset",
      "li",
      "tbody",
      "td",
      "tfoot",
      "th",
      "thead",
      "tr",
    ])

    # Elements that aren't block but should generate a newline in #to_text
    INLINE_LINE_BREAK = Set.new(["br"])

    STRICT_BLOCK_LEVEL = STRICT_BLOCK_LEVEL_HTML4 + STRICT_BLOCK_LEVEL_HTML5
    BLOCK_LEVEL = STRICT_BLOCK_LEVEL + LOOSE_BLOCK_LEVEL
    LINEBREAKERS = BLOCK_LEVEL + INLINE_LINE_BREAK
  end

  ::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants(::Loofah::Elements)
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
loofah-2.24.0 lib/loofah/elements.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/loofah-2.22.0/lib/loofah/elements.rb
loofah-2.23.1 lib/loofah/elements.rb
loofah-2.23.0 lib/loofah/elements.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/loofah-2.22.0/lib/loofah/elements.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/lib/loofah/elements.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/lib/loofah/elements.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/lib/loofah/elements.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/lib/loofah/elements.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/lib/loofah/elements.rb
loofah-2.22.0 lib/loofah/elements.rb
loofah-2.21.4 lib/loofah/elements.rb
loofah-2.21.3 lib/loofah/elements.rb
loofah-2.21.2 lib/loofah/elements.rb
loofah-2.21.1 lib/loofah/elements.rb
loofah-2.21.0 lib/loofah/elements.rb
loofah-2.21.0.rc1 lib/loofah/elements.rb