Ionic liquids as versatile precursors for functionalized porous carbon and carbon-oxide composite materials by confined carbonization.