In situ template synthesis of hierarchical porous carbon used for high performance lithium–sulfur batteries