Capillarity in complicated geometries