Sha256: 8a1d4efd6d3977e08a251e917071afa4e843ce5614628b3a957326e3479fc4fd

Contents?: true

Size: 753 Bytes

Versions: 6

Compression:

Stored size: 753 Bytes

Contents

require 'chunks/chunk'

# These are basic chunks that have a pattern and can be protected.
# They are used by rendering process to prevent wiki rendering
# occuring within literal areas such as <code> and <pre> blocks
# and within HTML tags.
module Literal
  # A literal chunk that protects 'code' and 'pre' tags from wiki rendering.
  class Pre < Chunk::Abstract
    PRE_BLOCKS = "a|pre|code"
    def self.pattern() Regexp.new('<('+PRE_BLOCKS+')\b[^>]*?>.*?</\1>', Regexp::MULTILINE) end
  end 

  # A literal chunk that protects HTML tags from wiki rendering.
  class Tags < Chunk::Abstract
    TAGS = "a|img|em|strong|div|span|table|td|th|ul|ol|li|dl|dt|dd"
    def self.pattern() Regexp.new('<(?:'+TAGS+')[^>]*?>', Regexp::MULTILINE) end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
Pimki-1.4.092 app/models/chunks/literal.rb
Pimki-1.5.092 app/models/chunks/literal.rb
Pimki-1.6.092 app/models/chunks/literal.rb
Pimki-1.7.092 app/models/chunks/literal.rb
Pimki-1.8.092 app/models/chunks/literal.rb
Pimki-1.8.200 app/models/chunks/literal.rb