Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Syntax highligth with textile: Syntax+RedCloth ?

Reply
Thread Tools

Syntax highligth with textile: Syntax+RedCloth ?

 
 
gabriele renzi
Guest
Posts: n/a
 
      12-30-2005
Hi gurus and nubys,

I was trying to mix RedCloth[1] with Syntax[2] and I'm
facing some small problems.
The idea is to forward parsing of <pre> tags to the HTML convertor
withouth touching the rest of the code.
I thought that I could subclass RedCloth and override #smooth_offtags
which seem quite nice since the starting <pre> tag is carried till that
point, which could allow, for example, parsing of something like
<pre lang="ruby">.

The problem is in the fact that RC escapes html entities before this
step, and thus when I call #convert on the string Syntax will tokenize
them and give back bad html.

Has someone ever faced this before and has an alternate solution?

thanks in advance.

[1]http://redcloth.rubyforge.org/
[2]http://syntax.rubyforge.org
 
Reply With Quote
 
 
 
 
Ross Bamford
Guest
Posts: n/a
 
      12-30-2005
On Fri, 30 Dec 2005 18:53:30 -0000, gabriele renzi
<(E-Mail Removed)> wrote:

> Hi gurus and nubys,
>
> I was trying to mix RedCloth[1] with Syntax[2] and I'm
> facing some small problems.
> The idea is to forward parsing of <pre> tags to the HTML convertor
> withouth touching the rest of the code.
> I thought that I could subclass RedCloth and override #smooth_offtags
> which seem quite nice since the starting <pre> tag is carried till that
> point, which could allow, for example, parsing of something like
> <pre lang="ruby">.
>
> The problem is in the fact that RC escapes html entities before this
> step, and thus when I call #convert on the string Syntax will tokenize
> them and give back bad html.
>
> Has someone ever faced this before and has an alternate solution?
>


Yup, don't it just suck? In the end we introduced a 'macro' concept by
which we could exempt sections of code from formatting filters.

Have a browse around here:

http://rubyforge.org/cgi-bin/viewcvs...ote/?root=rote

Particularly inside 'page.rb' and the 'filters' directory, which has
various filters including syntax and redcloth.

--
Ross Bamford - http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
gabriele renzi
Guest
Posts: n/a
 
      12-31-2005
Ross Bamford ha scritto:
> On Fri, 30 Dec 2005 18:53:30 -0000, gabriele renzi
> <(E-Mail Removed)> wrote:
>
>> Hi gurus and nubys,
>>
>> I was trying to mix RedCloth[1] with Syntax[2] and I'm
>> facing some small problems.
>> The idea is to forward parsing of <pre> tags to the HTML convertor
>> withouth touching the rest of the code.
>> I thought that I could subclass RedCloth and override #smooth_offtags
>> which seem quite nice since the starting <pre> tag is carried till
>> that point, which could allow, for example, parsing of something like
>> <pre lang="ruby">.
>>
>> The problem is in the fact that RC escapes html entities before this
>> step, and thus when I call #convert on the string Syntax will
>> tokenize them and give back bad html.
>>
>> Has someone ever faced this before and has an alternate solution?
>>

>
> Yup, don't it just suck? In the end we introduced a 'macro' concept by
> which we could exempt sections of code from formatting filters.


yeah, I was leaning to the same solution, even if I still want to try
out redefining to_html with something like
def to_html
expand pre tags
super
end

> Have a browse around here:
>
> http://rubyforge.org/cgi-bin/viewcvs...ote/?root=rote
>
> Particularly inside 'page.rb' and the 'filters' directory, which has
> various filters including syntax and redcloth.


great thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Checker that's better than the normal syntax checker Jacob Grover Ruby 5 07-18-2008 05:07 AM
Syntax error? What syntax error? Assignment fo default values? Mark Richards Perl Misc 3 11-18-2007 05:01 PM
Syntax bug, in 1.8.5? return not (some expr) <-- syntax error vsreturn (not (some expr)) <-- fine Good Night Moon Ruby 9 07-25-2007 04:51 PM
[ANN] SqlStatement 1.0.0 - hide the syntax of SQL behind familiarruby syntax Ken Bloom Ruby 3 10-09-2006 06:46 PM
Tool survey for syntax for formal => actual eadgbe VHDL 3 09-11-2003 11:37 AM



Advertisments