Hierarchically porous nitrogen-doped carbon as cathode for lithium–sulfur batteries