while this works, the ebuild syntax should be

if use doc; then
   foo