diff --git a/README.markdown b/README.markdown index 94b4e9c..f8d01e1 100644 --- a/README.markdown +++ b/README.markdown @@ -66,6 +66,8 @@ RbbCode supports the following BBCode features: * [i] * [u] * [s] + * [size] + * [color] * [url] * [img] * [quote] diff --git a/lib/rbbcode.rb b/lib/rbbcode.rb index cc9849a..d00261a 100644 --- a/lib/rbbcode.rb +++ b/lib/rbbcode.rb @@ -25,16 +25,17 @@ def self.parser_class end RbbCodeGrammarParser end - + def initialize(options = {}) @options = { :output_format => :html, :emoticons => false, :sanitize => true, + :unsupported_features => :remove, :sanitize_config => RbbCode::DEFAULT_SANITIZE_CONFIG }.merge(options) end - + def convert(bb_code, options = {}) # Options passed to #convert will override any options passed to .new. options = @options.merge(options) @@ -69,4 +70,4 @@ def convert_emoticons(output) def output_format @options[:output_format] end -end \ No newline at end of file +end diff --git a/lib/rbbcode/node_extensions.rb b/lib/rbbcode/node_extensions.rb index 0498c19..041114a 100644 --- a/lib/rbbcode/node_extensions.rb +++ b/lib/rbbcode/node_extensions.rb @@ -5,7 +5,7 @@ def strip_quotes(str) str.sub(/^"+/, '').sub(/"+$/, '') end end - + module RecursiveConversion def recursively_convert(node, output_method, options, depth = 0) if node.terminal? @@ -34,7 +34,7 @@ def recursively_convert(node, output_method, options, depth = 0) end end end - + module DocumentNode def to_html(options) contents.elements.collect { |p| p.to_html(options) }.join @@ -44,10 +44,10 @@ def to_markdown(options) contents.elements.collect { |p| p.to_markdown(options) }.join end end - + module ParagraphNode include RecursiveConversion - + def to_html(options) # Convert all child nodes, concatenate the results, # and wrap the concatenated HTML in

tags. @@ -66,7 +66,7 @@ def to_markdown(options) markdown + "\n\n" end end - + module BlockquoteNode include RecursiveConversion @@ -102,7 +102,7 @@ def to_markdown(options) end + "\n\n" end end - + module BlockquoteLineNode # Returns the number of line breaks after this line. May be zero for the final # line, since there doesn't have to be a break before [/quote]. @@ -113,7 +113,7 @@ def post_breaks module ListNode include RecursiveConversion - + def to_html(options) # Convert the :contents child node (defined in the .treetop file) # and wrap the result in