diff --git a/Rakefile b/Rakefile index 7b0672d..c662a0f 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,7 @@ begin rescue LoadError require 'rdoc/rdoc' require 'rake/rdoctask' - require 'rdoc/task' + require 'rdoc/task' RDoc::Task = Rake::RDocTask end diff --git a/lib/ruby-bbcode-to-md.rb b/lib/ruby-bbcode-to-md.rb index 376021a..ea5590e 100644 --- a/lib/ruby-bbcode-to-md.rb +++ b/lib/ruby-bbcode-to-md.rb @@ -27,7 +27,7 @@ def self.validation_enabled # This method converts the given text (with BBCode tags) into a HTML representation # The escape_html parameter (default: true) escapes HTML tags that were present in the given text and therefore blocking (mallicious) HTML in the original text # The additional_tags parameter is used to add additional BBCode tags that should be accepted - # The method paramter determines whether the tags parameter needs to be used to blacklist (when set to :disable) or whitelist (when not set to :disable) the list of BBCode tags + # The method parameter determines whether the tags parameter needs to be used to blacklist (when set to :disable) or whitelist (when not set to :disable) the list of BBCode tags def self.to_html(text, escape_html = true, additional_tags = {}, method = :disable, *tags) text = text.clone diff --git a/lib/ruby-bbcode-to-md/bbtree.rb b/lib/ruby-bbcode-to-md/bbtree.rb index 93c8921..2bdc963 100644 --- a/lib/ruby-bbcode-to-md/bbtree.rb +++ b/lib/ruby-bbcode-to-md/bbtree.rb @@ -91,4 +91,4 @@ def to_html(tags = {}) end end -end \ No newline at end of file +end diff --git a/lib/ruby-bbcode-to-md/debugging.rb b/lib/ruby-bbcode-to-md/debugging.rb index f09639c..33bad57 100644 --- a/lib/ruby-bbcode-to-md/debugging.rb +++ b/lib/ruby-bbcode-to-md/debugging.rb @@ -1,12 +1,12 @@ module RubyBBCode def self.log(string, clear_file = true) clear_log_file_at_beginning_of_execution clear_file - + File.open('/tmp/ruby-bbcode.log', 'a') do |f| f.puts string end end - + def self.clear_log_file_at_beginning_of_execution(clear_file) return if !clear_file if defined?(@@cleared_file).nil? @@ -16,16 +16,16 @@ def self.clear_log_file_at_beginning_of_execution(clear_file) end end end - - + + # This module can be included in the BBTree and TagNode to give them debugging features module DebugBBTree # For Debugging/ visualization purposes. - # This can be used to render the #nodes array in a pretty manor, showing the hirarchy. + # This can be used to render the #nodes array in a pretty manor, showing the hierarchy. def to_v tree = self visual_string = '' - + walk_tree(tree) do |node, depth| indentation = ' ' * depth case node[:is_tag] @@ -35,11 +35,11 @@ def to_v visual_string += "#{indentation}\"#{node[:text]}\"\n" end end - + visual_string end - - + + # this blocky method counts how many children are # in the TagNode.children, recursively walking the tree def count_child_nodes(hash = self) @@ -50,13 +50,13 @@ def count_child_nodes(hash = self) count end - # For BBTree, teh to_s method shows the count of the children plus a graphical - # depiction of the tree, and the relation of the nodes. - # For TagNodes, the root-most tag is displayed, and the children are counted. + # For BBTree, the to_s method shows the count of the children plus a graphical + # depiction of the tree, and the relation of the nodes. + # For TagNodes, the root-most tag is displayed, and the children are counted. def to_s object_identifier = "#<#{self.class.to_s}:0x#{'%x' % (self.object_id << 1)}\n" close_object = ">\n" - + case self when RubyBBCode::BBTree object_identifier + "Children: #{count_child_nodes}\n" + self.to_v + close_object @@ -68,26 +68,26 @@ def to_s end end end - + private - - # This function is used by to_v and anything else that needs to iterate through the + + # This function is used by to_v and anything else that needs to iterate through the # @bbtree def walk_tree(tree, depth = -1, &blk) return enum_for(:walk_tree) unless blk # ignore me for now, I'm a convention for being versatile - + # Perform the block action specified at top level!!! yield tree, depth unless depth == -1 - + # next if we're a text node return if tree.type == :text - + # Enter into recursion (including block action) for each child node in this node tree.children.each do |node| walk_tree(node, depth + 1, &blk) end end - + end - -end \ No newline at end of file + +end diff --git a/lib/ruby-bbcode-to-md/tag_collection.rb b/lib/ruby-bbcode-to-md/tag_collection.rb index 9e92e72..490a91e 100644 --- a/lib/ruby-bbcode-to-md/tag_collection.rb +++ b/lib/ruby-bbcode-to-md/tag_collection.rb @@ -118,4 +118,4 @@ def between_text_goes_into_html_output_as_param? end end -end \ No newline at end of file +end diff --git a/lib/ruby-bbcode-to-md/tag_node.rb b/lib/ruby-bbcode-to-md/tag_node.rb index 40ed60f..67614c9 100644 --- a/lib/ruby-bbcode-to-md/tag_node.rb +++ b/lib/ruby-bbcode-to-md/tag_node.rb @@ -64,4 +64,4 @@ def tag_param=(param) end end -end \ No newline at end of file +end diff --git a/lib/tags/tags.rb b/lib/tags/tags.rb index a3551c4..2471315 100644 --- a/lib/tags/tags.rb +++ b/lib/tags/tags.rb @@ -1,7 +1,7 @@ module RubyBBCode module Tags # tagname => tag, HTML open tag, HTML close tag, description, example - # All of these entrys are represented as @dictionary in the classes (or as the variable tags) + # All of these entries are represented as @dictionary in the classes (or as the variable tags) # A single item from this file (eg the :b entry) is refered to as a @definition @@tags = { :b => { diff --git a/test/ruby_bbcode_test.rb b/test/ruby_bbcode_test.rb index 24f05d0..72e8d67 100644 --- a/test/ruby_bbcode_test.rb +++ b/test/ruby_bbcode_test.rb @@ -165,7 +165,7 @@ def test_stack_level_too_deep end - def test_mulit_tag + def test_multi_tag input1 = "[media]https://www.youtube.com/watch?v=cSohjlYQI2A[/media]" input2 = "[media]http://vimeo.com/46141955[/media]" diff --git a/test/test_helper.rb b/test/test_helper.rb index 1773bd6..1ca1f19 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ require 'ruby-bbcode-to-md' require 'minitest/autorun' -# This hack allows us to make all the private methods of a class public. +# This hack allows us to make all the private methods of a class public. class Class def publicize_methods saved_private_instance_methods = self.private_instance_methods diff --git a/test/unit/debugging_test.rb b/test/unit/debugging_test.rb index ba38a1f..f9a8eb8 100644 --- a/test/unit/debugging_test.rb +++ b/test/unit/debugging_test.rb @@ -2,7 +2,7 @@ class RubyBbcodeTest < MiniTest::Unit::TestCase include ::RubyBBCode::Tags - + def test_bbtree_to_v text = "[i][b]a[/b][b]a[/b][b]a[/b][b]a[/b]item 1[/i][i]item 2[/i]" visual = <