On the thermomechanics of continuous media with diffusion and/or weak nonlocality