Ruby-bbcode-to-md discourse plugin bug report by madeingermany

Current plan, FYI:

@Scrutinizer is going to modify the migration script preprocessing routine and when he is ready, I will test on a staging instance.

All references to the plugin ruby-bbcode-to-md will be deleted from all our .yml build files, in all staging and production servers.

For reference only:

Reference: PDF copy of original bug report before closed and deleted.

Code:

Bottom line: Reporting serious bugs over at meta on plugins with their name on it is not well received, to say the least. This is the second time I have been shut down for reporting a bug over there. Ironically, I promised myself I would not post any more bug reports there, but I thought I would try one last time (since the bug was so serious).

I will not make that mistake again. Many guys over there at meta (not all, but some key players) are too proud of themselves to accept real bug reports or any criticism because its makes them look bad (in their minds) or tarnishes their self-image as masters of the all things tech in the universe.

They have a lot to learn, but at the same time, they thing they know it all. Like many social networks online, they have become too exclusive and seemingly trapped in a group-think bubble of their own making.

Basically, to date, I have received little of value over there (little more than Google reveals) and my developing time is better spent reading code and testing. My bugs reports are squashed but not the bugs.

Is this the new normal ?

1 Like

Go for it....

However, @Scrutinizer and @Neo have a different solution and so we are abandoning this gem of a gem.

However, if anyone wants to fix that Ruby gem, please do so (we can use it as a plugin for new posters who want to use legacy bbcode instead of markdown).

However, for migration, @Scrutinizer said he will take care of this problem in the migration preprocessing method.

Thanks.

PS: Honestly, moving forward after migration is done and dusted. I think better that we avoid supporting legacy bbcode and stick to markdown (but if anyone wants to rewrite the gem and use that plugin, please go for it).

1 Like

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 :slight_smile:

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/

No Joy...

I worked on this for two more hours:

... and still cannot make this broken discourse plugin work correctly for code fragments with left square brackets :frowning:

Anyone care to try?

This broken Ruby gem plugin is making me tired

:frowning: :frowning:

The goal is to detect the bbcode pairs, and to substitute each known pair by the corresponding md pair.

The translations are so much different, that one ERE for all won't work, and even a loop over a parameterized ERE is unlikely to work.
Further, a simple ERE is limited to a line - while the code pairs can span over multiple lines. You can solve this by setting a special end-of-line delimiter in perl - if you know perl.

So step one is to learn ruby, especially its capabilities and limits.

We have decided to abandon trying to improve the ruby-bbocde-to-md plugin because we can accomplish this without it.

@Scruitizer has done some detailed analysis and has shown that we can do the migration task (when we redo it) without the use of the ruby-bbcode-to-md plugin and, at the same time, can provide extended bbcode options to members who are more familiar with bbcode versus markdown.

The main flaw was in the ruby-bbcode-to-md Ruby gem but there was also some flaws in the Ruby preprocessing script in the original vbulletin.rb migration script.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.