Fixed block inside loops which failed to render blocks properly.

There was an strange issue when `{% block title %}` was inside for loop then context was not properly rendered. Also added some testcases to make sure its integrity.