Ask Your Question
0

Is there a way to escape the < character?

asked 2010-10-12 08:14:13 -0500

Benoit gravatar image Benoit flag of United States
865 22 8 31

I'm trying to have some text bracketed with <> like: < option >
However, if I don't put a space between the first < and the word, it is interpreted as an html tag.

Is there a way to escape the < ?

It's not a big deal, just a cosmetic issue.

delete close flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2010-10-12 10:08:06 -0500

kraryal gravatar image kraryal
26 1

To escape html characters, you usually want the & code for it.

For < use "&#60;" where you want "<".
For > use "&#62;" where you want ">".

This link has most of the characters. http://www.ascii.cl/htmlcodes.htm

link publish delete flag offensive edit
0

answered 2010-10-12 12:09:56 -0500

Evgeny gravatar image Evgeny flag of Chile
11059 50 84 182
http://askbot.org/

updated 2010-10-12 12:10:10 -0500

where do you need to escape it? If it's in the django or jinja template (askbot master branch already switched to jinja - if you need help with porting any of your custom templates - pls let me know), then use "escape" filter on values.

{{somevalue|escape}}

and it will do what @kraryal said automatically.

link publish delete flag offensive edit

Comments

Cool feature, but I don't think this would work right. I don't want to replace ALL instances of < I simply wanted a way to occasionally be able to write <option>. @kraryal provided a good way to do that. Benoit ( 2010-10-13 07:20:29 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2010-10-12 08:14:13 -0500

Seen: 36 times

Last updated: Oct 12 '10