A general metriplectic framework with application to dissipative extended magnetohydrodynamics. (June 2020)