Forum: Ruby on Rails RedCloth and lang specific hooks

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb96620826312516bb4a2d6deeee6688?d=identicon&s=25 Jean-Christophe Michel (Guest)
on 2006-01-18 18:18
(Received via mailing list)
Hi,

I use textilize() which is a great way of letting end users edit
contents.
But the code in RedCloth is quite compact, and doesn't allow for easily
adding correct typographic behaviour depending on the lang of the text.
For instance, correct quoting uses round double quotes in english and
double carons « » in french; the spaces before punctuation can be
corrected too. I'd like to know if there is an effort somewhere to clean
up a bit the RedCloth code, and add an api to hook some behaviours from
ruby code.

Another very similar point would be the ability to add some custom tags
in textitlize, like #mycontroller/myreport# that would create a div from
the myreport action of mycontroller (ie, call render_component). I can
do it now with replacement before and after textilize calls, but it's a
bit heavy...
--
Jean-Christophe Michel
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2006-01-18 19:49
(Received via mailing list)
Jean-Christophe Michel wrote:
 > I use textilize() which is a great way of letting end users edit
 > contents. But the code in RedCloth is quite compact, and doesn't
allow
 > for easily adding correct typographic behaviour depending on the lang
 > of the text. For instance, correct quoting uses round double quotes
in
 > english and double carons « » in french; the spaces before
punctuation
 > can be corrected too. I'd like to know if there is an effort
somewhere
 > to clean up a bit the RedCloth code, and add an api to hook some
 > behaviours from ruby code.

I dealt with a similar problem last summer while trying to devise a
system that could export from Textile to HTML or plain text. What I
ended up doing was writing my own object to do the Textile to whatever
conversion which used Redcloth internally and repaired Redcloth output
as it was generated. It's not as clean as it could have been, but it
worked really well.

Composition may be your ticket.

--
John Long
http://wiseheartdesign.com
This topic is locked and can not be replied to.