Pore structure and application of MgO-templated carbons