Theory of NMR field-gradient spectroscopy for anomalous diffusion in fractal networks