Ruby Forum Radiant CMS > New RedCloth

Posted by Ollivier Robert (keltia)
on 24.07.2008 12:06
(Received via mailing list)
Have you seen this announcement?

http://feeds.feedburner.com/~r/RubyInside/~3/342732232/redcloth-4-released-962.html

Apart from dropping of Markdown support (does radiant use it?), it
could be interesting to update it.
Posted by Sean Cribbs (seancribbs)
on 24.07.2008 15:44
(Received via mailing list)
How would people feel about switching to a gem dependency on the latest
RedCloth (instead of packaging it)?

Sean
Posted by Chris Parrish (cparrish)
on 24.07.2008 17:06
(Received via mailing list)
I'm fine with it.  Looks like a good improvement too.

Now all we need is a better Markdown parser.

-Chris
Posted by Sean Cribbs (seancribbs)
on 24.07.2008 17:17
(Received via mailing list)
Someone was working on a branch that uses rdiscount, an improved
Markdown parser.

Sean
Posted by Jim Gay (Guest)
on 24.07.2008 17:24
(Received via mailing list)
It's a bit of a detour from Radiant being geared toward shared hosting.

John Muhl is working on a branch than uses RDiscount (which is a
better Markdown parser).
http://github.com/johnmuhl/radiant/tree/markdown

On Jul 24, 2008, at 11:05 AM, Chris Parrish wrote:

>> Sean
>>
>> Ollivier Robert wrote:
>>> Have you seen this announcement?
>>>
>>> http://feeds.feedburner.com/~r/RubyInside/~3/342732232/redcloth-4- 
>>> released-962.html
>>>
>>> Apart from dropping of Markdown support (does radiant use it?), it
>>> could be interesting to update it.

Jim Gay
http://www.saturnflyer.com
Posted by Chris Parrish (cparrish)
on 24.07.2008 17:32
(Received via mailing list)
I understood discoount to be *nix only (no Windows).  I'll have to look
into it further.

-Chris
Posted by Sean Cribbs (seancribbs)
on 24.07.2008 17:35
(Received via mailing list)
That was my main concern... I'd like to continue packaging the library
with Radiant, but it is no longer pure-Ruby and must be compiled.  That
said, RubyGems has greatly improved since we started down this road.

Sean
Posted by john muhl (Guest)
on 24.07.2008 19:54
(Received via mailing list)
On 2008/07/24, at 07:44, Sean Cribbs wrote:

> How would people feel about switching to a gem dependency on the  
> latest RedCloth (instead of packaging it)?

I think it's going to have to happen at some point unless Radiant
wants to keep using the same old text parsing libraries from
2004/2005. Waiting for the pure ruby libraries catch back up is the
other (wishful) option.


On 2008/07/24, at 09:31, Chris Parrish wrote:

> I understood discoount to be *nix only (no Windows).  I'll have to  
> look into it further.

That's right. Although there isn't anything really stopping it from
being compiled for windows with mingw just like they did RedCloth 4;
except of course finding people who use windows to do the work :)
There is also PEG markdown (rpeg-markdown in ruby land) but right now
it is completely unusable on big (huge?) spans of text and I'm not
sure it's any easier to get running in windows. Personally, I'd rather
have a PEG based Markdown than a Discount based one.


As far as getting a new Markdown parser into core I'd say don't even
bother yet. As has been stated Discount doesn't (yet) run on windows,
and PEG Markdown is crashy (and probably doesn't run on windows either).

I would definitely like to see Radiant upgrade to RedCloth 4 sometime
soon. If no one jumps up to take it on in the next week, I'll try to
get it running then.


p.s. I did put together a standalone Markdown filter that uses
rdiscount, so if you can install gems and don't run windows you can
use that until something better is in the core. I use it on live sites
with no problems (some were even started with the standard Markdown
filter and upgraded without issue).

http://github.com/johnmuhl/radiant-markdown-extension
Posted by Chris Parrish (cparrish)
on 24.07.2008 21:19
(Received via mailing list)
I saw somewhere that Luis Lavena was researching porting rDiscount to
Windows but also that it didn't look good (discount depends on some *nix
only libraries, I think)

Hopefully I'm wrong, though.

Either way, I didn't mean to hijack a thread.  New Redcloth for all!

-Chris
Posted by Luis Lavena (luislavena)
on 26.07.2008 11:35
(Received via mailing list)
On Thu, Jul 24, 2008 at 9:18 PM, Chris Parrish
<chris.parrish-forummail@swankinnovations.com> wrote:
> I saw somewhere that Luis Lavena was researching porting rDiscount to
> Windows but also that it didn't look good (discount depends on some *nix
> only libraries, I think)
>
> Hopefully I'm wrong, though.
>
> Either way, I didn't mean to hijack a thread.  New Redcloth for all!
>

Thread-hijacking... :-)

rDiscount uses some neat posic tricks that allow them use callbacks
from file operations in a in-memory file (mapped file). This function
is name funopen and fopencookie.

There is no way to recreate that in Windows, tried and failed (maybe
because my C-fu is not good enough). There are better ways that the
same can be accomplished but we should be careful not to exploit with
huge memory buffers.

Maybe someone can write a ragel for markdown and we all enjoy a
BlueCloth like the new RedCloth? ;-)
--
Luis Lavena
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams
Posted by Arik Jones (imakethings)
on 27.07.2008 04:16
Jim Gay wrote:
> It's a bit of a detour from Radiant being geared toward shared hosting.
> 
> John Muhl is working on a branch than uses RDiscount (which is a
> better Markdown parser).
> http://github.com/johnmuhl/radiant/tree/markdown

Simply gem unpack. Easy peasy. Also, Webfaction is one of the best in
terms of shared hosting, rails and radiantcms.
Posted by Jasper Kooij (jjkooij)
on 30.07.2008 19:23
How do I try the new RedCloth 4 with radiant? I do remember seeing 
instructions somewhere.

Jasper


Posted by Jason Garber (jgarber)
on 25.08.2008 22:24
(Received via mailing list)
I just sent a pull request to make RedCloth a gem dependency, so
hopefully edge will have that ability soon.

In the meantime, I used some code like this in an extension:
# Get the latest version of RedCloth
Object.send :remove_const, :RedCloth if Object.const_defined?(:RedCloth)
$:.delete File.join(RADIANT_ROOT, 'vendor', 'redcloth', 'lib')
gem 'RedCloth', '>= 4.0.3'
require 'RedCloth'

Hope it works for you.

Jason
Posted by Jason Garber (jgarber)
on 25.08.2008 23:01
(Received via mailing list)
Make that:
# Get the latest version of RedCloth
Object.send :remove_const, :RedCloth if Object.const_defined?
(:RedCloth) && RedCloth::VERSION.is_a?(String)
$:.delete File.join(RADIANT_ROOT, 'vendor', 'redcloth', 'lib')
gem 'RedCloth', '>= 4.0.3'
require 'RedCloth'
Posted by Jason Garber (jgarber)
on 26.08.2008 22:00
Jasper,

I've just put out a redcloth4 Radiant extension: 
http://ext.radiantcms.org/extensions/28-redcloth4

Give that a try.

Jasper Kooij wrote:
> How do I try the new RedCloth 4 with radiant? I do remember seeing 
> instructions somewhere.
> 
> Jasper
Posted by Jasper Kooij (jjkooij)
on 27.09.2008 06:34
Hi Jason,

I've tried to load it using the extension way but that failed. Then I 
did the git way and that worked fine :

 [~/radiant]# script/extension redcloth4
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/vendor/rails/activeresource/lib/../../activesupport/lib/active_support/dependencies.rb:263:in 
`load_missing_constant': uninitialized constant 
Radiant::Extension::Script::Redcloth4 (NameError)
        from 
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/vendor/rails/activeresource/lib/../../activesupport/lib/active_support/dependencies.rb:453:in 
`const_missing'
        from 
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/lib/radiant/extension/script.rb:193:in 
`const_get'
        from 
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/lib/radiant/extension/script.rb:193:in 
`execute'
        from script/extension:5
 [~/radiant]# cd ~/radiant
 [~/radiant]# git clone 
git://github.com/jgarber/radiant-redcloth4-extension.git 
vendor/extensions/redcloth4
Initialized empty Git repository in 
/home/xxxx/radiant/vendor/extensions/redcloth4/.git/
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 16 (delta 4), reused 0 (delta 0)
Receiving objects: 100% (16/16), 11.14 KiB, done.
Resolving deltas: 100% (4/4), done.
Posted by Jason Garber (jgarber)
on 03.10.2008 17:00
Jasper Kooij wrote:
> Hi Jason,
> 
> I've tried to load it using the extension way but that failed.
> 
>  [~/radiant]# script/extension redcloth4

You have to specify an action to do with the extension, like install:

# script/extension install redcloth4

That works perfectly.  You'd get the same error if you tried 
script/extension page_attachments

Hope the extension is working out well for you!

Jason
Posted by Jasper Kooij (jjkooij)
on 03.10.2008 17:05
Jason Garber wrote:
> Jasper Kooij wrote:
>> Hi Jason,
>> 
>> I've tried to load it using the extension way but that failed.
>> 
>>  [~/radiant]# script/extension redcloth4
> 
> You have to specify an action to do with the extension, like install:
> 
> # script/extension install redcloth4
> 
> That works perfectly.  You'd get the same error if you tried 
> script/extension page_attachments
> 
> Hope the extension is working out well for you!
> 
> Jason

Hi Jason,

Thanks for pointing that out that i've missed the obvious! I am using 
it, trying to get the hang of redcloth. I relly don't want to install a 
wysiwyg unless i have to.

Thanks

Jasper