Code cleanup + refactoring in Template Handler.

* Params.dict and Params.named were computing the dictionary
  each time they were called which is not necessary.  Added
  memoized properties that compute these dicts once per tpl.

* Did some code refactoring and cleanup in template handler code
  in preparation for setting up template params object to be
  passed to the VE.  The template target was not being resolved
  when the PHP preprocessor was called to expand template
  transclusions.  Updated code to resolve template target always
  so that the template params object can be set up as per
  http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary#Non-semantic_parameter_editing

* No change in parser tests (as it should be for refactoring).

Change-Id: I6d5b16413521a1c3359499a2883647ec6b07eeda
Merge "Code cleanup + refactoring in Template Handler."