Sha256: 487b7766c7cc9874ba55d8dc2bb45a464a87bda1c1836b7e33e014c09ff02a0e

Contents?: true

Size: 475 Bytes

Versions: 4

Compression:

Stored size: 475 Bytes

Contents

require 'wparser/parse'

module Blocks
  class Pre < Parse
    BLOCK_TABLE = {
      ">||"     => '<pre>',
      "||<"     => '</pre>',
      ">|code|" => '<pre class="prettyprint">',
      "|code|<" => '</pre>'
    }

    def self.parse line
      block_rex = %r! 
        (^>\|\|)|(^\|\|<)           # pre
        |
        (^\>\|code\|)|(^\|code\|\<) # google-code-prettify
      !x

      @result = line.gsub(block_rex){|s| BLOCK_TABLE[s]}
      super
    end 
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wparser-0.1.3 lib/wparser/block/pre.rb
wparser-0.1.2 lib/wparser/block/pre.rb
wparser-0.1.1 lib/wparser/block/pre.rb
wparser-0.1.0 lib/wparser/block/pre.rb