Yes, that is a better specification. And it reduces some of the problems with a naive approach. But it also doesn't match the original request which called for \& and \< to work.

But I'm still reluctant to support such a scheme because it doesn't match anything else. It is rather oddball compared to both what the site supports and to what Perl supports (and making it match Perl closer makes it too much of a backward compatability problem). It also doesn't fit in with the processing (HTML-filtering) scheme already being done so it likely has a higher performance penalty than other alternatives.

I'd rather move forward with older proposals for improvements such as 1) supporting some of &lb; &lsb; &lsqb; or whatever the list was (plus the s/l/r/ partners), 2) Switching to using [[ ... ]] for making links, 3) making a user setting such that [link] gets displayed as "[link]" instead of "link" (users who have no problems remembering how to escape square brackets can disable the setting), etc. These also introduce backward compatability issues but the work for addressing them is better justified because they are more general solutions.

The amount of work involved just doesn't seem justified to me for such a oddball solution to a single problem that already has several solutions (that each are part of some bigger scheme that solves more than just that one problem) and several other (less one-off, less oddball) alternate solutions proposed. Such "bolted-on" fixes tend to pile up and make a system more fragile, inconsistent, hard to understand, etc.

I'm least opposed to having \[ (and maybe \& and \<) work in the public CB. That greatly reduces the processing overhead problem and restricts the backward compatability to monk habits (in a way that should only very rarely be noticed). I was originally thinking that supporting \& and \< would be good because it would mean that \ at least solves more than one problem, but \& appears fairly frequently in Perl code and I've already eliminated most of the problem with unescaped <'s (I didn't even bother to escape any of my <'s in this node) so I'm back to thinking only \[ should be special.

This would address the primary location of the problem (in my experience). Since I've actually seen several people try \[ in public chatter, I think it would be helpful there.

Going down that road a bit further, in order to implement it for the public CB without impacting the filtering code, we'd need to process \[ before processing links. So we'd do CODE tags, then m/\\+\[/, then links and HTML filtering. That might work well. I'd appreciate comments, especially from monks with lots of experience on the site.

- tye        


In reply to Re^3: How to escape square bracket in PM? (specs) by tye
in thread How to escape square bracket in PM? by johnnywang

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.