Sha256: ea09c3d318f106a584e012bb19625cd9a60952b447956b9d469b6a260be94b81
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
require 'bbcoder/base' require 'bbcoder/configuration' require 'bbcoder/tag' require 'bbcoder/buffer' require 'bbcoder/buffer_tags' require 'bbcoder/string' BBCoder.configure do tag :p tag :b, :as => :strong tag :i, :as => :em tag :u tag :s, :as => :strike tag :del tag :ins tag :ol tag :ul tag :li, :parents => [:ol, :ul] tag :dl tag :dt, :parents => [:dl] tag :dd, :parents => [:dl] tag :quote do quoted = meta.empty? ? '' : "\n <legend>#{meta} says</legend>" <<-EOS <fieldset>#{quoted} <blockquote> #{content} </blockquote> </fieldset> EOS end tag :code do <<-EOS <div class="bbcode-code #{meta}"> <pre>#{content}</pre> </div> EOS end tag :spoiler do <<-EOS <fieldset class="bbcode-spoiler"> <legend>Spoiler</legend> <div>#{content}</div> </fieldset> EOS end tag :url, :match_link => /^https?:\/\// do if meta.nil? || meta.empty? %(<a href="#{content}">#{content}</a>) else %(<a href="#{meta}">#{content}</a>) end end tag :img, :match => /^https?:\/\/.*(png|bmp|jpe?g|gif)$/, :singular => true do %(<a href="#{singular? ? meta : content}"><img src="#{singular? ? meta : content}" /></a>) end tag :youtube do <<-EOS <iframe width="560" height="349" src="https://www.youtube.com/embed/#{content}" frameborder="0" allowfullscreen></iframe> EOS end tag :sub, :singular => true do %(<sub>#{singular? ? meta : content}</sub>) end tag :sup, :singular => true do %(<sup>#{singular? ? meta : content}</sup>) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bbcoder-1.1.1 | lib/bbcoder.rb |