Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

escaping square brackets within signatures?

by Adze (Acolyte)
on Mar 18, 2002 at 15:42 UTC ( [id://152493]=monkdiscuss: print w/replies, xml ) Need Help??

I've tried many combinations of the suggested escaping techniques within the Monastery, but I simply can't manage to obtain a signature which is one of my JAPHs wrapped in <code> tags, because the square brackets get changed to perlmonk links as soon as I submit my new user settings. The &#091; trick doesn't work.

In fact, previewing this post has possibly revealed another problem. It seems that <code> escapes any contained HTML entities. I can see why this is desirable, but what if I want to include "</code>" within a <code></code> section? That last sentence is a good example of wanting to be able to do such a thing, and of the bug, if you're able to look at the raw data I just typed in.

Replies are listed 'Best First'.
(tye)Re: escaping square brackets within signatures?
by tye (Sage) on Mar 18, 2002 at 16:33 UTC

    You can use <tt>@ARGV &amp;&amp; $ARGV&#91;0&#93; eq "-h"</tt> in your signature. You can certainly consider this a bug. Note, however, that using <code> tags in your signature would result in the contained text being appended whenever anyone uses the "d/l code" link to grab any code you posted.

    In addition to what you used, you can use <code></co</code><code>de></code> to get </code>. In real code, you can use many different techniques:

    warn "Found <code>...</co"."de>\n" if "s#<code>(.*?)<\/code>#escape($1)#e;
    Unfortunately, providing more alternatives for escaping </code> inside of <code> tags requires the designation of some escaping mechanism which then forces us to require that any code containing this escaping mechanism escape it. Which means there are more instances of code where special tricks have to be done.

    As you've already noticed, allowing & to be used to escape characters would cause major problems. We'd have to make the escaping mechanism rather long and something very unlikely to appear in existing code and yet something that people might realize requires special processing. It'd be best if use of this escaping mechanism would result in "invalid" mark-up under the old rules.

    For example, you could designate that </code></code> is used to escape </code> inside of <code> tags. Which means that you could then use <code></code></code></code> to get </code>. Doesn't look too good, eh? I'm not convinced it is worth the effort to try to add something like this. (:

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://152493]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-20 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found