Convex functionals and partial regularity