Theory of nitrogen doping of carbon nanoribbons: edge effects.