fix typo
bug fixed: close template angle brackets correctly
added function to generate linkdef for template attr