Sha256: 3346e4826839879e1107f500130f3ae579b2544518a84ffa8d3bdfc5ddfe61e5

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 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

4 entries across 4 versions & 2 rubygems

Version Path
Pimki-1.0.092 app/models/chunks/literal.rb
Pimki-1.1.092 app/models/chunks/literal.rb
Pimki-1.2.092 app/models/chunks/literal.rb
instiki-0.9.2 app/models/chunks/literal.rb