Knowledge Base / Appnel Solutions 

Last Modified
9 October 2007 @ 9pm

Tidy for Movable Type Manual

Tidy for Movable Type keeps your template markup formatting uniform and more readable.

Movable Type 4 introduces the support of case insensitive tag names that do away with nagging and generally silent publishing errors because the wrong case was used in a tag name. Choice is good and avoiding errors is even better; however, over time, and with multiple developers potentially working on templates, inconsistently formatted markup is hard to read, understand and maintain.

Tidy for MT adds a list action labeled "Tidy MT Markup" in the drop down menu of each template listing page. Simply select one or more templates from the list, choose "Tidy MT Markup" and then click Go. MT will then tidy each selected template and save it to the database. Simple.

Formatting

Tidy for MT applies the following rules that was considered the best practice formatting of MT template markup by an informal consensus on MT developer mailing list.

  • All tag names and arguments will be in lowercase text.
  • Template tags will use the mt: prefix as opposed to the MT (no colon) of previous versions. Tidy will maintain alternate namespaces prefixes such as mtapp.
  • Variable tags will include a $ inside of each angle bracket. Block tags, including conditionals, will NOT. (Using $ with block tags has never been supported.)

Future Considerations and Hacking

This plugin will eventually support the automatic tidying of a template when saved; however, a little glitch in implementing this feature was hit along the way. In the spirit of release early and release often this feature was rolled back so the plugin could be released.

Those wishing to hack this version of the plugin can open `config.yaml` in the `mt/plugins/tidy` directory and remove the # symbols from the start of the callback section.

    #callbacks:
    #  tmpl_tidy:
    #    callback: MT::Template::pre_save
    #    handler: MT::Plugin::Tidy::pre_save
    #    priority: 10

This will enable the automatic tidying of every template when saved in every blog. The current glitch is in providing a enable/disable settings switch on a per blog basis using a YAML file.


 

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated. Please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form.

Back to Home