script: add support for if/else/endif