Hi,
why the lucky stiff wrote:
RedCloth 3 is out. You know? RedCloth? Perhaps you've heard of it. Or
Yes. I use it a lot.
perhaps you've used Textile, the simple text markup it parses. Okay, well then: RedCloth turns Textile markup into HTML.
<http://www.whytheluckystiff.net/ruby/redcloth/>
But RedCloth's gaze has fallen upon new text formats to devour. The new RedCloth 3 adds preliminary support for Markdown. This means that you can intermingle Textile and Markdown together!
However I ran into a stragne, um ...ommm, behaviour, I don't understand.
Perhaps something is wrong with my RedCloth?
When I run this code,
--- code starts here ---
require 'redcloth'
puts "Running RedCloth #{RedCloth::VERSION}"
f = 'test.rdcl'
puts "*"*80, f, "*"*80
rc = RedCloth.new( File.read( f ) )
puts rc.to_html
File.open( 'rc.html', 'wb'){ | file | file.puts rc.to_html }
--- code ends here ---
.... I get that result:
Running RedCloth 3.0.0
···
********************************************************************************
test.rdcl
********************************************************************************
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:592: warning: ambiguous first argument; put parentheses or even spaces
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:802: warning: ambiguous first argument; put parentheses or even spaces
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:1001: warning: ambiguous first argument; put parentheses or even spaces
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:785: warning: method redefined; discarding old inline_markdown_link
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:423: warning: instance variable @filter_styles not initialized
C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:566:in `gsub!': Stack overflow in regexp matcher: /((?:\n*[\# ](?:[^\n]|\n+[\# ]|\n(?!\n|\Z))+)|(?:\n*[\* ](?:[^\n]|\n+[\* ]|\n(?!\n|\Z))+)|(?:\n*[> ](?:[^\n]|\n+[> ]|\n(?!\n|\Z))+))|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m (RegexpError)
from C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:566:in `blocks'
from C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:276:in `to_html'
from E:/stephan/source/zz_delete-me/rc_3.rb:6
The test file is at the end of the message.
What makes me kind of clueless is this: Whatever I remove, the overflow disappears. Even removing a single word (doesn't work with all words though...) - overflow's gone.
For example removing 'an ' from the line >>>\t** "ImageMagick":http://www.imagemagick.org/ is an OpenSource tool for graphics manipulation.<<< will get rid of the overflow. However grammatically that's not an option, I think.
This happens on both Linux running Ruby 1.8.2 (preview2) and WinXP running the 1-click-installer (1.8.2 too).
Ah well, the behaviour doesn't happen in 2.0.11.
Any help would be greatly appreciated.
Happy rubying
Stephan
--- test.rdcl follows until the end of the message body
h2. Software & Tools
* Programming Languages and Data Formats
** "Ruby":Ruby Programming Language, is purely object-oriented. If offers a flexible Syntax and is easy to learn. Furthermore working with it is quite productive.
** "RedCloth":http://www.whytheluckystiff.net/ruby/redcloth/ is a Ruby implementation of "Textile":Textism: Tools: Textile. "Textile is a text format. A very simple text format", says _why_the_lucky_stiff author of RedCloth. The "RedCloth Project":http://rubyforge.org/projects/redcloth/ offers more information about it.
* Development Tools
** "Rake":http://rubyforge.org/projects/rake/ is like "make" -- but it's entirely written in Ruby. A rake introduction is on the site of "Jim Weirich":Rake - Building with Rake, author of this software
** "Subversion":http://subversion.tigris.org/ is an Open Source version control system. Subversion runs on both, Linux and Windows. "TortoiseSVN":http://tortoisesvn.tigris.org/ is a convenient and comfortable GUI client for Windows.
* Graphic,Text-/Office-Applications and Utilities
** "OpenOffice.org":http://www.openoffice.org/
** "ImageMagick":http://www.imagemagick.org/ is an OpenSource tool for graphics manipulation.
** "Rmagick":http://rmagick.rubyforge.org/
** "TextPad":http://www.textpad.com/
** "TotalCommander":http://www.ghisler.com/ -- if you liked the "Norton Commander", you'll probably like this tool. It's a files system browser offering a lot of additional features
** "GnuPlot":http://www.gnuplot.info/ you can interactively (and automatically) display data plots. To a certain extent data analysis is possible, too.<br>
* Operating systems -- in _alphbetical_ order
** "Linux™":SUSE – Open-Source-Lösungen für Enterprise Server und Cloud | SUSE
** "Windows™":http://www.microsoft.com/
h3. Useful stuff