Line Breaks in Textile

Sorry if this question doesn’t belong here, but I figured one of you
guys might know the answer.

I just set up a fresh 0.66 installation and am using Textile to format
the pages I write.

Everything is working wonderfully except that line breaks do not
generate “
” tags. Instead, they simply make a new line in the HTML
code. Example:

Paragraph one.

Paragraph
two.

…should render:

Paragraph one

Paragraph
two

…instead, it renders:

Paragraph one

Paragraph two

Is this a recent change in Textile or something Radiant-specific? On the
“Textile Tryout” page (http://www.textism.com/tools/textile/index.php)
it DOES insert the “
” tag. However on the “Textile Reference” page
(Textile Reference) under “Line Breaks”, the author seems to say
that “
” is no longer part of the functionality.

Have any of you guys had problems with this?

Ben,

RedCloth (the Ruby implementation of Textile) does not necessarily
follow the Textism version exactly. If you need
tags, just put
them in there and it will oblige.

Sean

Ben,
RedCloth is the Ruby library Radiant uses to format Textile.
Unfortunately, the latest release 3.0.4 is notoriously awful. The
upcoming release, 4.0, adheres to the official Textile 2 reference
exactly, including the line breaks you speak of. I recommend you
give the pre-release testing gem a try.

$ gem install RedCloth --source http://code.whytheluckystiff.net

(Note that RedCloth is camel case.) Make sure it’s working by
opening up irb and typing RedCloth::VERSION and noting the version
number is higher than 3.0.4.

That alone probably won’t work for your Radiant install because
Radiant includes RedCloth in the vendor directory rather than
allowing it to be loaded from gems. You either have to remove that
directory or, if you’re using Radiant in instance mode, add this hack
to the environment.rb file after the require ‘boot’ and before the
require ‘radius’.

*** hack to get RedCloth out of vendor ****

$:.reject! {|p| p =~ /vendor/redcloth/ }

Then check that it’s installed properly by starting Radiant’s
console: ./script/console and typing RedCloth::VERSION.

RedCloth 4.0 will probably be released by May 1.

Jason G.

Jason,

Thanks for that information! I attempted the hack, however after
following your instructions, the RedCloth version still appears to be
3.04. I checked the console on a regular rails directory just to make
sure I had correctly installed the newer version of the RedCloth gem…
and indeed I had.

That said, it’s not really a time-critical app, so if 4.0 will indeed
be out by the 1st, that’ll work just fine.

Ben,

Well, if it’s not working with the 3.290 gem, it won’t work any
better with 4.0. The problem is with Radiant. I’ll try it tomorrow
with 0.6.6 and see what I can come up with.

Jason

Jason,

You seem really up-to-date on the progress of RedCloth. Since it’s
being reimplemented in Ragel, will the code still be pure Ruby, or will
it be part-Ruby, part-C?

Sean

Part Ruby, part C. It could also be Java—Ragel outputs Ruby, C,
Java, and many others—but someone has to write the Java glue. So
far, no one has stepped forward. :slight_smile:

Hi Jason,

As Java developer I could take a look at it, I’m don’t have alot of free
time at the moment, but I can always give a look !

Could you send me some information / documentation ?

Regards

Peter.

On Tue, Apr 22, 2008 at 1:20 PM, Jason G. [email protected]
wrote:

being reimplemented in Ragel, will the code still be pure Ruby, or will it

see what I can come up with.

3.04. I checked the console on a regular rails directory just to


Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


met vriendelijke groet,

Peter B.

Jason G. wrote:

Well, if it’s not working with the 3.290 gem, it won’t work any
better with 4.0.

Sorry for the confusion, I meant that line breaks DO work with the 3.29
gem. However, I couldn’t get Radiant to use 3.29.

After using the hack you posted my Radiant console still reports
RedCloth’s version is 3.04.

Ben,

Try adding the path to the gem to the front of config.load_paths in
environment.rb. Example:

config.load_paths.unshift “/path/to/gems/RedCloth-3.2.9.0/lib”

Sean

Ben,

Sean’s suggestion worked for me in an instance of Radiant 0.6.0.

Added…
config.load_paths.unshift “/usr/local/lib/ruby/gems/1.8/gems/
RedCloth-3.290/lib/”

inside the Radiant::Initializer block. Your gem path will vary.