Legendrian foliations on almost S-manifolds