Posted By: why the lucky stiff
Date: 2005-09-18 05:59
Summary: RedCloth 3.0.4 (little things)
Project: RedCloth

This release fixes a bunch of minor things. Escaping of angle brackets because it's smart. better acronym detection, list problems that were tossing exceptions, and most notably: single and double quotes are working in a lot more situations.

Latest News
BinData 1.5.0 - source moved to github
    Dion Mendel - 2013-05-21 11:10
v13.5.0 Released !!
    id 774 - 2013-05-18 12:28
Runt v0.9.0 Released
    Matthew Lipper - 2013-05-17 00:11
kramdown 1.0.2 released
    Thomas Leitner - 2013-05-09 06:58
mime-types 1.23 Released
    Austin Ziegler - 2013-04-21 01:41

 

Forums | Admin

Discussion Forums: redcloth-3.0.4--little-things-

Start New Thread Start New Thread

 

By: Зоран Рилак
RE: Order of hard breaks / block parsing? [ reply ]  
2007-06-08 02:34
A little hacking and here's what I got:

def hard_break( text )
text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/,
"\\1<br />\n" ) if hard_breaks
end

Adding an extra \n at the end of the replacement pattern yields \n\n in the result string, which are later correctly recognized as a block separator.

By: Зоран Рилак
Order of hard breaks / block parsing? [ reply ]  
2007-06-07 23:13
It is quite possible that I am missing the gist of it, but here goes: a lot of people have been complaining on the 'net that RedCloth 3.0.4 messes up block parsing when hard_breaks are on. I looked into the code and found that hard_breaks are applied to the text *before* blocks are parsed. Therefore:

(before) text == 'block1\n\nblock2'

hard_break text # text == 'block1<br />\nblock2
...
blocks text

The call to blocks(text) now produces incorrect results because BLOCKS_GROUP_RE == /\n{2,}(?! )/m . Block boundary has been destroyed by inserting a <br /> in place of the first \n.