Ab initio methods for L-edge x-ray absorption spectroscopy