User:Dantman/Skinning system/Monobook template/Less pointless xml

From mediawiki.org

The thought here is to give up on being something that can be parsed with a xml/html library and go all out with our own syntax making it only based on the xml it's around rather than dependent on it's syntax.

Here instead of having things like separate <mw:if test="..."></mw:if> elements and <div mw:if=""></div> attributes for the same thing we only have the attribute and instead support a sort of null element. A <mw:if=""> starting tag is really a null element with the same mw:if="" as a div. These null elements can be ended with the first mw:* used like </mw:if>, just a end mw like </mw> or a null end element </>.

Likewise <mw:msg key="foo" /> is shortened to <mw:msg="foo" />. Technically the pattern would mean a mw:msg="foo" attribute is permitted though if we do follow that we should probably try to discourage use of it, as an attribute that completely replaces the contents of the block doesn't make as much sense as one that makes the element conditionally omit-able or repeats the contents.

I did end up with things like <mw:$.header /> ($.header means the 'header' key in the current context, eg: the header in the current section of a sidebar)

<div id="globalWrapper">
	<div id="column-content">
		<div id="content" lang="mw:page">
			<a id="top" />
			<mw:region="messages" size="wide" special />
			
			<div class="pageicons" mw:optional><mw:pageicons /></div>
			<h1 id="firstHeading" class="firstHeading"><mw:title /></h1>
			<div id="bodyContent">
				<div id="siteSub"><mw:msg="tagline" /></div>
				<mw:subtitles />
				<div id="jump-to-nav" lang="mw:user" mw:if="pref:showjumplinks"><mw:msg="jumpto" /> <a href="#column-one"><mw:msg="jumptonavigation" /></a>, <a href="#searchInput"><mw:msg="jumptosearch" /></a></div>
				
				<mw:region="body" size="wide" primary />
				<div class="visualClear"></div>
			</div>
		</div>
	</div>
	<div id="column-one" lang="mw:user">
		<div id="p-cactions" class="portlet">
			<h5><mw:msg="views" /></h5>
			<div class="pBody">
				<ul mw:loop="content_actions" />
			</div>
		</div>
		<div class="portlet" id="p-personal">
			<h5><mw:msg="personaltools" /></h5>
			<div class="pBody">
				<ul lang="mw:user" mw:loop="personal_tools" />
			</div>
		</div>
		<div class="portlet" id="p-logo">
			<a style="background-image: url({logo|size=155x155});" href="{nav.mainpage}" mw:tooltip="p-logo" accesskey></a>
		</div>
		<script>if (window.isMSIE55) fixalpha();</script>
		<mw:loop="sidebar">
			<div class="{generated}generated-sidebar{/generated} portlet" id="p-*" mw:tooltip>
				<h5 mw:optional><mw:$.header /></h5>
				<div class='pBody'>
					<mw:$.content />
				</div>
			</div>
		</mw:loop>
	</div><!-- end of the left (by default at least) column -->
	<div class="visualClear"></div>
	<div id="footer" lang="mw:user">
		<mw:loop="footericons:icononly">
			<div id="f-*ico" mw:loop>
				<mw:$.icon />
			</div>
		</mw:loop>
	 
		<ul id="f-list" mw:optional mw:loop="footerlinks:flat" />
	</div>
</div>