While squeezing some extra functionality out of the template system, I came across this gem in the documentation for Mojo.Model.format():
"They may return a string, which is used for the formatted version of the model property, or alternatively a hash of formattedPropertyName -> formattedValue..."
This is pretty straightforward at first and if you plan on using the method as recommended by those who designed the Mojo framework. If you have used template formatters, you know that when you return just a formatted string value from, say, the objectName property, it is referenced in the HTML as #{objectNameFormatted}. The unformatted value is still referenced as #{objectName}.
The second option for formatting property values lends itself to stupid tricks. Don't let the word "hash" fool you, it's just a regular JavaScript object with named properties. The neat part is that the object's properties are now available as #{variables} in the HTML. For instance (please forgive the formatting, as I haven't worked on the core of this site in a while), if I return this object from a formatter:
{'foo': 1, 'bar': 'BARBARBAR'}
I can then have #{foo} and #{bar} in my HTML. At first glance, it may not seem very worthwhile to use this second option. In fact, using the string return method, you can add any number of formatted values to the template. But, one thing you can do with the hash method is return another object as one of the property values. I'll leave it up to you to think about all the nifty possibilities that affords. Oh, and if you want to, you can use the bound object or collection's property names as the properties in the return object. That means you don't have to append the "Formatted" string in your HTML for that property. Be advised that this MIGHT overwrite the actual model value (which is something that doesn't happen when using string returns), but I haven't tested that yet.