One thing that has been bugging me about Winter is that code must be left aligned or else MediaWiki will format it with some HTML. This made it impossible to write neat code, especially in longer programs. I finally hit upon a decent workaround and now program code is much more readable.
Before:
{{#function | formatNum ||
{{#if | {{#1}} | {{#1}} | no more }} bottle{{#if | {{#1 == 1}} | | s }}
}}
{{#for | {{#i = 99}} || {{#i >= 0}} || {{#i --}} ||
{{#bottles | @= | {{#formatNum | {{#i}} }} }}
{{#ucfirst | {{#bottles}} }} of beer on the wall, {{#bottles}} of beer.
{{#if | {{#i}} |
Take one down and pass it around, {{#formatNum| {{#i - 1}} }} |
Go to the store and buy some more, 99 bottles
}} of beer on the wall
}}
After
{{#function | formatNum ||
{{#if | {{#1}} || {{#1}} || no more }} bottle{{#if | {{#1 == 1}} || || s}}
}}
{{#for | {{#i @= 99}} || {{#i >= 0}} || {{#i --}} ||
{{#bottles | @= | {{#formatNum | {{#i}} }} }}
{{#ucfirst | {{#bottles}} }} of beer on the wall, {{#bottles}} of beer.
{{#if | {{#i}} ||
Take one down and pass it around, {{#formatNum| {{#i - 1}} }}
||
Go to the store and buy some more, 99 bottles
}} of beer on the wall.
}}
I’ve also added features to access the various template parameter variables used on a page, as well as various other upgrades and bug fixes.
- changed syntax so that carriage returns are ignored if followed by a space
- added template variable access
- added time, microtime, date, urlencode, explode, implode, request_var, template_var, to_str, to_int, show_page_text, version, wordwrap, keep_nl
- added ^. escape char
- added <winterprewiki> tag which allows winter to be used before mediawiki processes it
- added addVar for external user functions to add variables
- added WinterBeforeProcess and WinterAfterProcess hooks
- added various information available at runtime such as user name, page name, etc
- fixed bug with nowinter tag
- fixed bug when using foreach with noexistent array
- fixed bugs with & and ? operators (they’re turned into html entities)
- fixed bug caused by pipes being returned in error messages
- updated error messages
Download Winter 2.1.0
Downloaded 663 times