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

Plight of the Left Square Bracket ( )

by mojotoad (Monsignor)
on Apr 09, 2002 at 20:54 UTC ( [id://157852]=monkdiscuss: print w/replies, xml ) Need Help??

Fellow Monks, Back in August, 2001, there was a discussion regarding the difficulty of typing the relatively common left square bracket '[' in nodes. The difficulty arises due to the shortcut mechanism for linking within the Monastery. As things stand, we have to remember the character code: [

In the discussion, several solutions were proposed:

  1. The specific literal character shortcut: &[;
  2. The generic literal character shortcut: &([); or \([)
  3. The simple escape: \[
  4. The ISO entity standard: [ (not implemented in many browsers, therefore would still require special consideration in the Everything engine. As a test for your browser, that entity is used here: [ )

I am curious if any work had been done on this; personally I favor #3 -- the "special" nature of the brackets in the Everything engine is a non-HTML exception and should be handled in a non-HTML kind of way. Any time exception facilities are provided, there should be straightforward "exception exceptions" (or "shortcut shortcuts"). If not the simple escape, then perhaps something more in-line with the existing Everything syntax, such as [[] or [\[] -- not pretty, but straightforward.

I am leary of munging with established HTML standards such as with &[; -- this is inviting trouble since the whole syntax is designed to be a mechanism to properly implement cross-standard character encodings. Not so for merely a single web engine's particular quirky shortcut syntax. If not the simple escape, then at least specifically handle the ISO standard until browsers catch up, since the bracket is integral to the normal usage of Everything.

Regardless, in addition to the Site How To, I think the current escape mechanism should be mentioned in the Writeup Formatting Tips in the Perl Monks Site FAQ and in a footnote on the linking writeup.

Much ado about nearly nothing? Am I only wanting to go into town and pick up some power converters?

Matt

Replies are listed 'Best First'.
(tye)Re: Plight of the Left Square Bracket ( [ )
by tye (Sage) on Apr 10, 2002 at 14:43 UTC

    First off, no, \[ will never be implemented. Currently \ is not special and implementing that proposal would require that it become special which would require that \\ become \ (otherwise what you write when you want \[ to appear?), which would break some existing nodes. But beyond that, what we don't need, IMHO, is more special characters than the current set of <, &, and [. I'm not even happy with the current specialness of | in node linking.

    One or more of the &yadda; forms will probably be implemented eventually. Though I personally find <code> and &#91; adequate.

    The handling of [ ] happens very late in the PM page processing. This was surprising to me and some of the existing PM code seems to indicate that this either wasn't always true, always planned, or always expected. I fixed one bug associated with it by making the default HTML escaping also escape [ and ]. That is why you can now use those characters in several fields of user settings including using <code> tags in your signature.

    This also fixed the problem with preview munging [ ] in subject lines. But it appears that preview turns &#91; into [ and that the final submit then strips the [. I'll have to look into that.

            - tye (but my friends call me "Tye")
Re: Plight of the Left Square Bracket ( )
by mojotoad (Monsignor) on Apr 09, 2002 at 20:56 UTC
    And while I'm at it -- there seems to be a bug in the preview/submit process. I had a left square bracket, properly encoded as &#091; in my title -- it showed up fine in preview, but was apparently stripped once I hit submit. Now there's a mysterious balloon in the title.

    Matt

Re: Plight of the Left Square Bracket ( )
by extremely (Priest) on Apr 09, 2002 at 22:58 UTC
    I've always been partial to <code>[</code> since it [is easy to remember] It does make them awfully tiny in some browsers tho.

    Maybe you could special case those constructs for single characters?

    --
    $you = new YOU;
    honk() if $you->love(perl)

      it would be nice if browsers rendered
      <code value="["/>
Re: Plight of the Left Square Bracket ( )
by Juerd (Abbot) on Apr 10, 2002 at 08:52 UTC

    Maybe I'm the only one, but I'm statisfied with &#91;. As with most decimal numbers, the leading zero is not required. Why not use it? It's simple once you know the ascii code, and the closing square bracket doesn't have to be encoded. Besides, you only need it in very short inline pieces of code, because with <code>-tags, it's already displayed correctly.

    I like none of the first four solution you mentioned, because they involve invalid html or html that isn't displayed correctly. The [[] syntax is even worse, and I think $foo&#91;123] is easier than $foo[[]123] or $foo[\[]123]

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-18 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found