hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

SuperRedCloth #

by why in inspect

I’m sick of RedCloth being my most nauseating library!! All those treacherous regexps…

 $ svn co http://code.whytheluckystiff.net/svn/redcloth/branches/superredcloth
 $ cd superredcloth
 $ rake

You’ll need the latest ragel installed. This will be ten times faster.

said on 22 Jan 2007 at 12:34

Is That A bird? Is That a Fox? No! it’s h1.SuperRedCloth!

said on 22 Jan 2007 at 12:37

Rake install :(

said on 22 Jan 2007 at 12:52

Yeah! I gotta say… this kind of blows my mind! It really gets right to the point.

said on 22 Jan 2007 at 12:54

If it solves at least a half of original RedCloth’s problems, it’s good enough for me :)

It’s like my every new project uses RedCloth now (which shows my addiction to textile formatting).

btw: .gem maybe?

said on 22 Jan 2007 at 12:56

Nicely done, and a great Ragel tutorial …

said on 22 Jan 2007 at 13:11

Where to send bug reports? Your test_blocks() test is invalid. Three things:

  • incorrect \n in h1 tag
  • incorrect \n in first p tag
  • redhanded.gif image is not linked as it should (:/test2)
said on 22 Jan 2007 at 13:29

Things I hate about RedCloth:

  • notextile does not really work!!
  • hard_breaks does not really work!!
  • The span that goes around CAPS words.
  • The bad handling of dashes—sometimes you get strikethroughs.
  • No recursion. You should be able to quote a section of RedCloth and the entire blockquote should be formatted nice.
  • the ‘x’ dimension character should be strict: digit space 'x' space digit. I don’t really like it in the first place, though. Like: 42” x 36” doesn’t work. So what’s the point?
  • Underscores and dashes in URIs should be ignored.

Bug reports. (Use your Rubyforge account and assign to version SUPER .)

said on 22 Jan 2007 at 13:39

Hot Damn! Thanks.

said on 22 Jan 2007 at 15:57

Ah, thank heavens. This is the way it should be done!

said on 22 Jan 2007 at 16:14

Cuack! That’s great man :) Thanks

said on 22 Jan 2007 at 16:14

Cool stuff _why.

May end up doing something with this in Ruport soon :)

said on 22 Jan 2007 at 16:48

Ragel looks good. As I took Theory of Computation, I wished so hard for something exactly like it.

said on 22 Jan 2007 at 17:41

Chapter ATE !!! Chapter ATE !!

said on 22 Jan 2007 at 18:38

My prayers have been heard! There must be a backdoor in the MouseHole…

said on 22 Jan 2007 at 23:12

I’ve been thinking writing a Textile lib with a real parser for ages. Damn you why! You win this time!

said on 23 Jan 2007 at 01:11

Faster AND prettier AND more ~5x more concise… 1808 LOC vs. 326 (ish)

said on 23 Jan 2007 at 01:22

How do I pass in :hard_breaks, etc… ie:

RedCloth.new( text, [:hard_breaks] ).to_html( :textile )

said on 23 Jan 2007 at 12:50

No recursion. You should be able to quote a section of RedCloth and the entire blockquote should be formatted nice.

This is consistently my biggest gripe with these human-friendly-markup things. It seems that you want a simple context-free language; I recommend looking at Lemon It’s not quite as powerful as Bison but it has advantages (cleaner syntax, reentrant, etc.) OTOH , ragel+recursion should at least work.

said on 23 Jan 2007 at 12:56

Is there a Packrat parser in Ruby btw?

said on 23 Jan 2007 at 15:13

TonyYayo: None of that is done yet. I’m working on lists and tables right now.

NikolasCo: I started using Lemon for this, actually, but it felt like too much. Textile isn’t begging to be broken up into tokens and structs. It just needs to be transformed.

I think bison is reentrant, but yacc isn’t. I’ve always really liked yacc/bison syntax actually, even though it was painful to learn because shift-reduce wasn’t explained very well when I first started using it some time ago.

Anyway, if anyone out there wants to learn Lemon, check out the lighttpd source. The configparser.y illustrates perfectly.

said on 26 Jan 2007 at 01:55

USING ALL MY RAM ! DAMN YOU _WHY!!!

Is it normal for it to use 800M of memory during rake?

said on 26 Jan 2007 at 02:03

OK – found the problem. DO NOT UNDER ANY CIRCUMSTANCES USE THE DEBAIN APT -INSTALLABLE RAGEL !

Compile 5.16 for yourself.

said on 26 Jan 2007 at 02:10

199 tests, 199 assertions, 58 failures, 0 errors rake aborted!

:( Debug time.

said on 26 Jan 2007 at 11:03

Slow down there. It’s using the tests from RedCloth 3. And I haven’t even finished with lists or tables yet. Most other things are perfect and some whitespace in the tests doesn’t match up.

Yes, don’t use anything less than Ragel 5.16!

said on 26 Jan 2007 at 19:03

Links oh the links, why do they fail me!

Probably because I used an ‘&’ in the text for the link!

the word definition in superredcloth_inline.rl:92 needs to be adjusted to accept various punctuation characters.

said on 27 Jan 2007 at 07:00

Boom. No worky.

said on 27 Jan 2007 at 09:07

ehird: this patch should fix it

said on 27 Jan 2007 at 10:34

tilman: doesn’t apply

said on 27 Jan 2007 at 10:58

Sure it does, just tested it again.

said on 27 Jan 2007 at 12:03

well… doesn’t here.

said on 27 Jan 2007 at 12:26

Hank o`o: Could you tell me which older version of Ragel that was?

said on 27 Jan 2007 at 13:14

ehird: tried running “patch -p0 -i thepatch.diff” from the checked out directory?

said on 27 Jan 2007 at 14:20

AdrianThursto: apt-cache show ragel: Version: 5.7-1

OLDDDD …

said on 27 Jan 2007 at 14:25

odd, i was doing that, but now it works :/

it’s fast.

said on 27 Jan 2007 at 14:26

er. how did that happen.

said on 27 Jan 2007 at 14:26

er. how did that happen.

said on 27 Jan 2007 at 15:02

Hanko `o: thanks!

said on 30 Jan 2007 at 11:11

I checked the Bison manual and generating reentrant parsers isn’t the default, but can be enabled via an option . Old-fashioned YACC doesn’t seem to have an equivalent.

11 Jul 2010 at 20:51

* do fancy stuff in your comment.

PREVIEW PANE