Surface functionalization of templated porous carbon materials