I cloned the ruby-bbcode-to-md
repo and built a Ruby gem test environment (for the first time ever) on my desktop and have been tracing the error in the ruby-bbcode-to-md
gem; and have traced the error to this file:
"lib/ruby-bbcode-to-md-neo/tag_sifter.rb"
This line:
def process_text
regex_string = '((\[ (\/)? (\w+) ((=[^\[\]]+) | (\s\w+=\w+)* | ([^\]]*))? \]) | ([^\[]+))'
So, I think the bug (one bug at least) may be in this regex above (in the original ruby-bbcode-to-md
code, I have not altered the regex yet). The regex above is from the current ruby-bbcode-to-md
repo (unchanged).
Even though have have nearly zero experience in building and testing Ruby gems (before today), I created this little doit
script so I could edit the various Ruby files in the gem quickly add a bunch of puts
statements to the code in the Ruby files, like this:
#edit various ruby files in the gem with puts statements and then ./doit
# cat doit
gem uninstall ruby-bbcode-to-md-neo
gem build ruby-bbcode-to-md.gemspec
gem install ruby-bbcode-to-md-neo-0.0.14.gem
ruby test.rb
# cat test.rb
require 'ruby-bbcode-to-md-neo'
#hello = 'for key in "${!aa[@]}"'.bbcode_to_md(false, {}, :disable, :quote)
hello = "[[ $string2 =~ ROS[0-9]+$ ]] && echo OK || echo NOK".bbcode_to_md
puts hello
Anyone care to check this regex and fix it?
'((\[ (\/)? (\w+) ((=[^\[\]]+) | (\s\w+=\w+)* | ([^\]]*))? \]) | ([^\[]+))'
I need to get ready for a 6 hours required road trip in the car today, so I may be off my desktop for a while; but I can easily test any regex you guys might come up with when I am back
FWIW, this is my first Ruby gem debug, edit, uninstall, build, install, test
dev cycle and I have no idea if there is any easier or better way, but this "neo kudges the gem" way works for debugging so far. Just back to basics with puts
and tracing where the bug first appears. Simple, brute force debugging.
Side Note: Am reading this book now:
http://ruby-doc.com/docs/ProgrammingRuby/