added support for nested models

Added a call to parameterize for div id generation to transform '::' into '-'.
Added an escaping for apostrofes in quotes inside javascript block generation.