Ru nanoparticles supported on nitrogen-doped porous carbon derived from ZIF-8 as an efficient catalyst for the selective hydrogenation of p-chloronitrobenzene and p-bromonitrobenzene.