Nesting tags, automatic closure

Posted by Nick Gammon on Wed 06 Jun 2001 04:39 AM — 1 posts, 6,535 views.

Australia Forum Administrator #0
With MUSHclient you can nest elements in your output, each one effectively "saves" its current state and restores it when it closes.


For example:


Normal <i> Italic <b> Bold Italic </b> Italic </i> Normal

This would appear as:

Normal Italic Bold Italic Italic Normal



You can even nest <send> elements although this is not recommended as it may be confusing.


Closure out of sequence

MUSHclient always closes tags in the opposite order that it opened them (thus allowing the reversion to previous styles mentioned previously).

If you try to close styles out of sequence you will get a warning message in the debug window (providing MXP debugging is not "none") and all intervening tags will be closed as well.


For example:


Normal <i> Italic <b> Bold Italic </i> Normal </b> Normal

This would appear as:

Normal Italic Bold Italic Normal Normal


In the above example, the </i> is out of sequence (because the most recent tag was <b>, so the <b> is closed automatically before the <i>.

This situation would generate two warning message:

1. Closing out-of-sequence MXP tag: <b>
2. Closing MXP tag </b> does not have corresponding opening tag

The second message occurs when the </b> tag is reached, because the <b> tag has already been closed it notices that there is no outstanding <b> to close.

Comment. The useful thing about this rule is that if you have something like this:


<rdesc> Room description
... a whole lot of messy tags here ...
</rdesc>


The </rdesc> is guaranteed to close all intermediate tags between <rdesc> and </rdesc>.


Closure of a tag that was never opened

In the event you close a tag that was not previously opened, then nothing happens (except for a warning message).

eg.


blah blah </b>


Because the <b> tag is not present, the </b> will not have any effect.