PDA

View Full Version : A shorter, easy way to Code in the Formattedtext



Samarex
June 11th, 2016, 11:25
Ok Here it is

Normally we have been doing <p>Text</p> to write a paragraph Well you can just do <p/>Text and it will come out the same. You can Also use the <i/>,<b/>,<h/>,<td/>,<tr/> commands without putting the closing tag.
I seen this in a couple other mod files recently and wondered what it was.,but had only seen the <p/> used. So today when I was inputting a Feats table, So I did some testing

Here is what I did
Old Way

<table>
<tr><td><b>Metamagic Feats</b></td><td><b>Prerequisites</b></td><td><b>Benefit</b></td></tr>
<tr><td><b><i>Empower Spell</i></b></td><td><i>--</i></td><td><i>Increase spell's variable, numeric effects by 50%</i></td></tr>
<tr><td><b><i>Enlarge Spell</i></b></td><td><i>--</i></td><td><i>Double spell’s range</i></td></tr>
<tr><td><b><i>Extend Spell</i></b></td><td><i>--</i></td><td><i>Double spell’s duration</i></td></tr>
<tr><td><b><i>Heighten Spell</i></b></td><td><i>--</i></td><td><i>Cast spells as higher level</i></td></tr>
<tr><td><b><i>Maximize Spell</i></b></td><td><i>--</i></td><td><i>Maximize spell’s variable, numeric effects</i></td></tr>
<tr><td><b><i>Quicken Spell</i></b></td><td><i>--</i></td><td><i>Cast spells as free action</i></td></tr>
<tr><td><b><i>Silent Spell</i></b></td><td><i>--</i></td><td><i>Cast spells without verbal components</i></td></tr>
<tr><td><b><i>Still Spell</i></b></td><td><i>--</i></td><td><i>Cast spells without somatic components</i></td></tr>
<tr><td><b><i>Widen Spell</i></b></td><td><i>--</i></td><td><i>Double spell’s area</i></td></tr>
</table>

After Testing
General Feats Code (just some)

<table>
<tr/><td/><b/>General Feats<td/><b/>Prerequisites<td/><b/>Benefit
<tr/><td/><b/>Acrobatic<td/> —<td/> +2 bonus on Jump and Tumble checks
<tr/><td/><b/>Agile<td/> —<td/> +2 bonus on Balance and Escape Artist checks
<tr/><td/><b/>Alertness<td/> —<td/> +2 bonus on Listen and Spot checks
<tr/><td/><b/>Animal Affinity<td/> —<td/> +2 bonus on Handle Animal and Ride checks
</table>

In the Second set The name of the Feat is Bold the rest is not , as the sec <td/> is not followed by a <b/> so it is not bold
For tag formating Example <td colspan="2"></td> you just write it <td colspan="2"/> and its works out the same.

Samarex
Would love to see some other shortcuts people have found.

Moon Wizard
June 11th, 2016, 21:52
I wouldn't suggest doing it the way you are proposing. While it may work for the moment, it is not correct from an XML perspective, and may lead to issues down the road as we change XML libraries for the next major version.

Regards,
JPG

Andraax
June 12th, 2016, 03:52
Well, *technically* it's correct XML. <p/> is an "open and close paragraph" in one tag. It's normally only used if you want to put in attributes without any elements. <p name="george" /> for example, is a complete paragraph tag with no text, but an attribute. The way it's being interpreted is incorrect in the initial post, and if it's ever fixed, it won't fail, but it won't do what you want either...

I happen to use this quite a bit in one of the systems we have at work, which processes XML where most directives can be supplied with just attributes.

Moon Wizard
June 12th, 2016, 18:06
Andraax is correct. The given output will not do what is expected, but is valid XML.

JPG