|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Tue Aug 14, 2007 1:09 pm
#SUB, #PSUB, and angle brackets |
I've always wondered why text substituted by #SUB obeys MXP tags, but that substituted by #PSUB doesn't. It would simplify and speed up triggers in some cases to support tags in #PSUB, rather than having to do reparse states in order to do this (I often create my own hyperlinks using <send> tags, or use <color> tags).
On the other hand, sometimes you don't want it interpreted. For example:
Code: |
#TRIGGER {*bar} {#SUB {%1 xxx}}
#TRIGGER {*bar} {#SUB {%quote(%1) xxx}} |
Do "#show <foo> bar" and you'll get " bar xxx" out of either.
Shouldn't the %quote() cause the angle brackets to get ignored? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Aug 14, 2007 1:59 pm |
There weren't actually any captures in your pattern, so I assume you meant %line instead of %1.
The trouble is that MXP tags are parsed out even if they're quoted. This is probably for zMUD compatability, because in zMUD, you needed to escape the opening triangular bracket to avoid them being parsed. In CMUD, they're not special characters any more and don't need to be quoted.
Perhaps the best way to handle this would be to only expand MXP tags if they're valid? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 14, 2007 5:00 pm |
Supporting MXP tags in PSUB is on the to-do list for the future.
As Fang mentioned, the %quote function only quotes special CMUD characters, like #, %, etc. So you don't want to use it in your above situation, because if you did:
#SHOW "#test bar"
then you would get "~#test bar" which probably isn't what you want either.
What we need is something like the PHP htmlencode that will encode the < and > into their XML entities. I'll add that to the wish list for the future. |
|
|
|
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Wed Aug 15, 2007 9:49 pm |
Ooh, htmlencode sounds nice - I found in zMUD that in adding my own MXP tags, I had to vary the syntax (i.e. quoting) depending on what type of setting it was in - it was not consistent.
|
|
|
|
|
|