Works for me. Make sure .to_json didn't get clipped off in the tag definition.

Sean

Patrick Scheips wrote:
On the page "extensions" in the Radiant backend the extension "Escape Json" 
appears as enabled.
So I used the tags <r:escape_jsonan> and </r:escape_json> in a page part.

The result is the following error message (appearing in the frontend):
undefined tag `escape_json'

I followed your (Sean's) instruction step by step.

Any ideas?

Thanks,
Patrick


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:radiant-
[EMAIL PROTECTED] Im Auftrag von Sean Cribbs
Gesendet: Dienstag, 9. Dezember 2008 14:54
An: radiant@radiantcms.org
Betreff: Re: AW: AW: AW: [Radiant] Escaping HTML Tags

Patrick:

Simply use the tag in the page that contains the text you want to
escape. e.g.

$('foo').update(<r:escape_json><div id="bar">Hello,
world!</div></r:escape_json>);

Sean

Patrick Scheips wrote:
Hi Sean,

Thanks, that worked great for me.
What to do next in order to use the tag?

Thanks in advance!

-- Patrick



-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:radiant-
[EMAIL PROTECTED] Im Auftrag von Sean Cribbs
Gesendet: Montag, 8. Dezember 2008 14:28
An: radiant@radiantcms.org
Betreff: Re: AW: AW: [Radiant] Escaping HTML Tags

I'm sorry I didn't make that clear.

1) Generate a new extension with `script/generate extension
escape_json`
2) Open vendor/extensions/escape_json/escape_json_extension.rb in a
text
editor
3) Inside the extension class, put:

def activate
    Page.class_eval do
        tag 'escape_json' do |tag|
            tag.expand.to_jso
        end
    end
end

4) Save the file, restart your server.

Sean

Patrick Scheips wrote:

Well, I'm not sure if I really understand that.
Where do I have to enter this and how to use it?

Thanks,
Patrick




-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:radiant-
[EMAIL PROTECTED] Im Auftrag von Sean Cribbs
Gesendet: Freitag, 5. Dezember 2008 17:10
An: radiant@radiantcms.org
Betreff: Re: AW: [Radiant] Escaping HTML Tags

Just thought of this... Rails has built-in support for JSON

escaping.

You could make a tag like this:

tag 'escape_json' do |tag|
  tag.expand.to_json
end

This will return a string with everything properly escaped.

Sean

Patrick Scheips wrote:


Thanks, Sean!
Unfortunately that doesn't work for me...

Patrick





-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:radiant-
[EMAIL PROTECTED] Im Auftrag von Sean Cribbs
Gesendet: Freitag, 5. Dezember 2008 16:40
An: radiant@radiantcms.org
Betreff: Re: [Radiant] Escaping HTML Tags

Patrick,

There is <r:escape_html>, which does a standard HTML escaping,
but
will


not escape quotes.  Not sure if that helps.

Sean

Patrick Scheips wrote:



Hi all,

is there a possibility to escape the HTML tags  of a Radiant
Page
in


order to pass them (and the rest of the page, of course) to a
JavaScript function (as a parameter)?



The problem is that I cannot pass content containing closing
HTML

tags (</b>, </p> and so on) to a JavaScript function - I have to


escape


the content by putting a backslash ( \ ) before the slash
(result:
<\/b>).



Any ideas how to escape such characters?

Thanks,
Patrick
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant





_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant



_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant




_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant



_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to