Compensation of resonant atomic dispersion using a pulse shaper