From ahodgkin at rowing.org.uk Fri Aug 4 10:49:29 2006 From: ahodgkin at rowing.org.uk (Andrew Hodgkinson) Date: Fri, 04 Aug 2006 14:49:29 +0000 Subject: Hard break broken in 3.0.4? Message-ID: <44D35E79.60504@rowing.org.uk> Is :hard_break working in RedCloth 3.0.4? $ ruby -v ruby 1.8.4 (2005-12-24) [i686-linux] $ pwd /lib/ruby/gems/1.8/gems/RedCloth-3.0.4/lib $ irb irb(main):001:0> require 'redcloth' => true irb(main):002:0> rc = RedCloth.new("h1. Heading\n\n_Not_ heading.") => "h1. Heading\n\n_Not_ heading." irb(main):003:0> rc.to_html(:textile) => "
Not heading.
" All good so far. But now: irb(main):004:0> rc.hard_breaks = true => true irb(main):005:0> rc.to_html(:textile) => "Escape
This
Escape
This .
First part - middle part - end part.
First part—middle part—end part.
Thing is, I *want* textism.com's output. Here's my workaround: >> RedCloth.new("First part-- middle part -- end part.").to_html => "First part—middle part—end part.
" (No space after 'First part') That's a little less natural for the non-techies who will be entering Textile data on my site. Is this a known issue, or is RedCloth correct? Thanks. -- Chris Wanstrath http://errtheblog.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20060822/e33c15db/attachment.html From fabienpenso at gmail.com Mon Aug 28 09:21:37 2006 From: fabienpenso at gmail.com (Fabien Penso) Date: Mon, 28 Aug 2006 15:21:37 +0200 Subject: bug / infinite loop Message-ID: <89fe6f1b0608280621h2b17a5aen8cf7c685cb1850b1@mail.gmail.com> Hi. I spent about 10 hours on saturday trying to understand why my blog/Typo was taking more than 500M and then crashing my server. There is a recursive function in redcloth.rb which is not written properly (a variant is in the parameters, but is not even checked. Variant is existing to be checked, not just print a debug...). Here is the patch to prevent this. Please apply them and release something soon because it's really nasty. -- http://penso.info/ -------------- next part -------------- --- redcloth.rb.old 2006-08-28 15:13:55.000000000 +0200 +++ redcloth.rb 2006-08-28 15:14:35.000000000 +0200 @@ -980,7 +980,10 @@ HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m - def glyphs_textile( text, level = 0 ) + def glyphs_textile( text, level = 50 ) + if level < 0 + return + end if text !~ HASTAG_MATCH pgl text footnote_ref text @@ -996,7 +999,7 @@ codepre = 0 if codepre < 0 end elsif codepre.zero? - glyphs_textile( line, level + 1 ) + glyphs_textile( line, level - 1 ) else htmlesc( line, :NoQuotes ) end From mat.mannion at gmail.com Tue Aug 29 07:06:15 2006 From: mat.mannion at gmail.com (Mat Mannion) Date: Tue, 29 Aug 2006 12:06:15 +0100 Subject: Several bug-fixes and improvements(?) Message-ID:|\s|^) # start of line?
\! # opening
(\<|\=|\>)? # optional alignment atts
(#{C}) # optional style,class atts
(?:\. )? # optional dot-space
([^\s(!]+?\.[^\s(!]+?) # presume this is the src
\s? # optional space
(?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title
\! # closing
(?::#{ HYPERLINK })? # optional href
/x
I made a couple of minor other alterations, such as adding the sterling (?)
symbol to the glyphs to be replaced with £, and adding a newline after
when hard_breaks are turned on to help readability.
In order to work well with our implementation, I also added an escape
capability, to allow a user to write \*text\* without the asterisks being
converted to tags.
If anyone wants the code for this then feel free to ask, I'm wary about
committing anything to SVN unless it's really wanted/needed
Regards,
Mat
--
Mat Mannion
Web Developer
e-lab, University of Warwick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20060829/a642efd7/attachment-0001.html