From dkarapetyan at gmail.com Tue Jul 3 18:52:17 2007
From: dkarapetyan at gmail.com (david karapetyan)
Date: Tue, 3 Jul 2007 15:52:17 -0700
Subject: redcloth 3.0.4 bug
Message-ID: <98e1ec810707031552w4f2bcf2ekd2b9d3e005de4e7d@mail.gmail.com>
irb(main):001:0> require 'redcloth'
=> true
irb(main):002:0> RedCloth.new("a^2^+b^2^=c^2^").to_html
=> "
a2^+b2=c2^
"
The output is not what I expect at all. Am I missing something or is this
actually a bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20070703/737f3895/attachment.html
From ghettofinger at gmail.com Mon Jul 16 12:08:00 2007
From: ghettofinger at gmail.com (andrew thornton)
Date: Mon, 16 Jul 2007 11:08:00 -0500
Subject: Advice regarding extending RedCloth
Message-ID:
Hello,
I am in a bit of a bind. I need to reliably parse mediawiki markup to
html, and the only parser that I can find (mediacloth) has a lot to be
desired, so I would like to extend something that works and parse
mediawiki markup. My question to this list is should I start working
on RedCloth or SuperRedCloth or is there a difference as far as
extending them? Also does anyone know of a write up that outlines
extending RedCloth or SuperRedCloth with new markup? I apologize if
these questions are a bit rudimentary for this list, but I appreciate
any and all input and help.
Thank you
From jg at jasongarber.com Mon Jul 16 12:48:44 2007
From: jg at jasongarber.com (Jason Garber)
Date: Mon, 16 Jul 2007 12:48:44 -0400
Subject: Advice regarding extending RedCloth
In-Reply-To:
References:
Message-ID:
Andrew,
I'm no expert on RedCloth, but I can offer what I've gathered working
with it for a little while (I'm jgarber if you're looking at the
RedCloth Timeline).
IMHO, parsing with Ragel, as SuperRedCloth has done, is excellent
because you get performance gains and the regexes are cleaner and
more hierarchical. Hard to explain, but trust me that Ragel is
hugely advantageous over plain Ruby. You have to learn Ragel, though.
SuperRedCloth was slated to become RedCloth 4.0, so I don't suggest
investing any effort in RedCloth 3. Will SRC ever actually see a
release? Hard to say. It would be really nice, since RedCloth 4.0.3
sucks so bad, but _Why hasn't touched it in months. I'm fixing some
bugs just so I can use it myself, but I don't have time or desire to
take it very far.
I'm also a little leery of having RedCloth do too much. The 3.0
series majorly messed up, IMO, when it tried to integrate Markdown.
It hybridized Textile and Markdown, but gave Textile priority when
they conflicted unless you changed an option. But Markdown's soft
breaks became the default even when writing in Textile unless you
turned on the :hard_breaks option, which didn't work properly
anyway. And then there was the :filter_html from early on, which was
useful but often neglected.
In short, it was a huge mess, largely because behavior changed over
time and there were too many options. People don't read
instructions. They just install the RedCloth gem (or it's
automatically installed as a gem dependency) and they expect to get
Textile like they're used to from Textpattern or Movable Type or Word
Press but they get this thing that doesn't quite work the same, or
else they update their gems and suddenly their output text looks
different.
So, I would like to keep SuperRedCloth pure and without many/any
options. I was pleased to see that _Why put hard breaks back in and
generally seems to be following the Textile2 "standards" (ha--
precedent?) more closely. I'm not the project owner, so he might
have a different opinion, but I'm generally glad to see the direction
it appears to be heading.
I'd encourage you to look at Maruku. It's a popular recent Markdown
interpreter and I noticed recently that on the home page Andrea
indicates he'd like to add Textile2 to the mix. I like the multiple-
formats-in, multiple-formats-out approach. Maybe he'd consider
adding Mediawiki too if you'd contribute it. Get in touch with him.
If you can't join Maruku, I'd recommend you make your own separate
project to handle Mediawiki. I think you'll have the easiest time
running your own project and having a separate name and everything.
Jason Garber
On Jul 16, 2007, at 12:08 PM, andrew thornton wrote:
> Hello,
>
> I am in a bit of a bind. I need to reliably parse mediawiki markup to
> html, and the only parser that I can find (mediacloth) has a lot to be
> desired, so I would like to extend something that works and parse
> mediawiki markup. My question to this list is should I start working
> on RedCloth or SuperRedCloth or is there a difference as far as
> extending them? Also does anyone know of a write up that outlines
> extending RedCloth or SuperRedCloth with new markup? I apologize if
> these questions are a bit rudimentary for this list, but I appreciate
> any and all input and help.
>
> Thank you
> _______________________________________________
> Redcloth-upwards mailing list
> Redcloth-upwards at rubyforge.org
> http://rubyforge.org/mailman/listinfo/redcloth-upwards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20070716/7c2e657f/attachment.html
From boss at topfunky.com Mon Jul 16 13:42:51 2007
From: boss at topfunky.com (Geoffrey Grosenbach)
Date: Mon, 16 Jul 2007 10:42:51 -0700
Subject: Advice regarding extending RedCloth
In-Reply-To:
References:
Message-ID: <15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
On 7/16/07, Jason Garber wrote:
> IMHO, parsing with Ragel, as SuperRedCloth has done, is excellent because
> you get performance gains and the regexes are cleaner and more hierarchical.
> Hard to explain, but trust me that Ragel is hugely advantageous over plain
> Ruby. You have to learn Ragel, though.
The current implementation of SRC makes it hard to subclass since
Ragel passes the parsed strings to SuperRedCloth class methods, not
instance methods. This would be the first thing that should be changed
if SRC is going to be useful for subclassing and for parsing or
emitting other formats.
--
Geoffrey Grosenbach
Screencast | http://peepcode.com
From jg at jasongarber.com Tue Jul 17 08:28:41 2007
From: jg at jasongarber.com (Jason Garber)
Date: Tue, 17 Jul 2007 08:28:41 -0400
Subject: Advice regarding extending RedCloth
In-Reply-To: <15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
References:
<15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
Message-ID:
Sorry, what's the problem with class methods?
$ irb -r superredcloth
irb(main):001:0> class MySrc < SuperRedCloth
irb(main):002:1> def self.p(opts)
irb(main):003:2> "my p"
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> SuperRedCloth.p(:text => 'hello')
=> "hello
"
irb(main):007:0> MySrc.p(:text => 'hello')
=> "my p"
Makes sense to use class methods to me since it's providing a service
of the class ("translate this hash of options into an HTML tag")
rather than working on an instance ("okay block object, translate
yourself into an HTML tag").
Jason
On Jul 16, 2007, at 1:42 PM, Geoffrey Grosenbach wrote:
> On 7/16/07, Jason Garber wrote:
>> IMHO, parsing with Ragel, as SuperRedCloth has done, is excellent
>> because
>> you get performance gains and the regexes are cleaner and more
>> hierarchical.
>> Hard to explain, but trust me that Ragel is hugely advantageous
>> over plain
>> Ruby. You have to learn Ragel, though.
>
> The current implementation of SRC makes it hard to subclass since
> Ragel passes the parsed strings to SuperRedCloth class methods, not
> instance methods. This would be the first thing that should be changed
> if SRC is going to be useful for subclassing and for parsing or
> emitting other formats.
>
> --
> Geoffrey Grosenbach
> Screencast | http://peepcode.com
> _______________________________________________
> Redcloth-upwards mailing list
> Redcloth-upwards at rubyforge.org
> http://rubyforge.org/mailman/listinfo/redcloth-upwards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20070717/de30dbcc/attachment.html
From boss at topfunky.com Tue Jul 17 12:41:53 2007
From: boss at topfunky.com (Geoffrey Grosenbach)
Date: Tue, 17 Jul 2007 09:41:53 -0700
Subject: Advice regarding extending RedCloth
In-Reply-To:
References:
<15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
Message-ID: <15754f7e0707170941v12ab8be7h256acb60f6fe2405@mail.gmail.com>
On 7/17/07, Jason Garber wrote:
> Makes sense to use class methods to me since it's providing a service of the
> class ("translate this hash of options into an HTML tag") rather than
> working on an instance ("okay block object, translate yourself into an HTML
> tag").
Maybe my problem was a detail of how I was using it. I wanted to do
state-based things like "Automatically apply this CSS class for the
first h1 in the entire document" or "Read separate code files
referenced by a special tag and inline them into the final document"
which meant saving file paths in instance variables.
--
Geoffrey Grosenbach
........................
Screencast | http://peepcode.com
From why at hobix.com Wed Jul 18 19:42:26 2007
From: why at hobix.com (why the lucky stiff)
Date: Wed, 18 Jul 2007 18:42:26 -0500
Subject: Advice regarding extending RedCloth
In-Reply-To: <15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
References:
<15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
Message-ID: <20070718234218.GF85022@beekeeper.hobix.com>
On Mon, Jul 16, 2007 at 10:42:51AM -0700, Geoffrey Grosenbach wrote:
> The current implementation of SRC makes it hard to subclass since
> Ragel passes the parsed strings to SuperRedCloth class methods, not
> instance methods. This would be the first thing that should be changed
> if SRC is going to be useful for subclassing and for parsing or
> emitting other formats.
In the Super branch, this has changed and I really think it's better
than SuperRedCloth, guys!!
You create class methods for everything you want to output and then
you pass it into the SuperRedCloth#to method:
class SuperRedCloth::Text
class << self
def p opts
opts[:text]
end
# ... h1, h2, h3, etc ...
end
end
Then to output:
str = SuperRedCloth.new(str)
str.to(SuperRedCloth::Text)
So, basically, SuperRedCloth.to_html is syntactic sugar for
SuperRedCloth.to(SuperRedCloth::HTML).
Follow?
_why
From boss at topfunky.com Fri Jul 20 12:51:05 2007
From: boss at topfunky.com (Geoffrey Grosenbach)
Date: Fri, 20 Jul 2007 09:51:05 -0700
Subject: Advice regarding extending RedCloth
In-Reply-To: <20070718234218.GF85022@beekeeper.hobix.com>
References:
<15754f7e0707161042k33107cdfobfcfe610df44ee07@mail.gmail.com>
<20070718234218.GF85022@beekeeper.hobix.com>
Message-ID: <15754f7e0707200951o793e2dc9p31741ad472dc312e@mail.gmail.com>
On 7/18/07, why the lucky stiff wrote:
> In the Super branch, this has changed and I really think it's better
> than SuperRedCloth, guys!!
>
> You create class methods for everything you want to output and then
> you pass it into the SuperRedCloth#to method:
Brilliant. I'll try this.
I'm using the feature of classic RedCloth where you can define a
method to handle a new block:
def textile_ruby
return "ruby code with styling"
end
....
ruby. here's some ruby code in my textile
Geoffrey Grosenbach