Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

The Great Escape

by ar0n (Priest)
on Jul 22, 2000 at 18:52 UTC ( #23905=monkdiscuss: print w/replies, xml ) Need Help??

I love that movie. Even though it was made 20+ years pre-me, it still is a good movie.

Anyway, getting to the point: alot of times there has been a need for the use of brackets as subscripts, anonymous arrays, etc instead of them being used as links to nodes. Mostly in this is needed in the chatterbox, because there's the possibility of using <code> tags, which escapes brackets in normal posts.

I don't know much about the Everything engine, but a with a quick glance I found the parser-routine. The following is just a minor alteration, to allow for escaping brackets. I chose the '+' because it has a similiar function distinguishing hashes from blocks (i.e affecting interpretation).

sub parseLinks { my ($text, $NODE) = @_; Everything::printLog("parseLinks"); $text =~ s/(.)*?\[(.*?)\]/linkNodeTitle ($2, $NODE)/egs unless + $1 eq "+"; $text; }

I know I could have just /msg'ed vroom with this, but I'm sure some monks will have something to say about this :).
Then again, maybe not.

-- aron | mail | home

Replies are listed 'Best First'.
RE: The Great Escape
by chromatic (Archbishop) on Jul 23, 2000 at 08:19 UTC
    That regex looks a little greedy. How about: s/(.)\[([^]]*?)\]]/linkNodeTitle ($2, $NODE)/egs unless $1 eq '+';
    Could be a little faster with the character class in there, too. It's certainly uglier!
      It sure is! :)

      One thing though:
      s/(.)?\[([^]]*?)\]]/linkNodeTitle($2, $NODE)/egs unless $1 eq '+';
      (just the (.)? has changed), so it'll allow node-links at the beginning of the node (i.e. without a character in front of it). Or am I wrong in assuming '.' won't match a null-character? Anyways, I can't remember why I did (.)*?, but in retrospect it's wrong. Thanks.

      -- ar0n | home | mail

re: The Great Escape
by N-Wing (Deacon) on Jul 23, 2000 at 01:25 UTC

    As the Site How To states, you can use [ and ] by using HTML in writeups:
    &#91; for [
    &#93; for ]

    The chatterbox is a bit more difficult though*... I do something like [[] for a normal [ (which shows as [ ) and ] can be typed normally.
    * this was done on purpose, to prevent certain abuses

    --== N ==--

      I've read the Howto, thanks. I was directing my post more towards the chatterbox. &#91;/&#93 hasn't worked in the chatterbox for a long time, and it still doesn't (i checked).
      Also, I've noticed if I had my signature like so:
      -- [ar0n]

      where the brackets would be interpreted as links, the pm-engine simply wouldn't fill in my .sig.

      -- ar0n | home | mail

RE: The Great Escape
by Macphisto (Hermit) on Jul 25, 2000 at 23:21 UTC
    Great flick! I always sit down to watch it and get nailed with work or my girlfriend comes over, etc, etc. Drives me nuts!

    The beatings will continue until morale raises.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://23905]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (1)
As of 2018-07-22 22:49 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (457 votes). Check out past polls.