Use tab weight when generating tab links.

From #3149.