An ionothermally synthesized Mg-based coordination polymer as a precursor for preparing porous carbons