API: Support inequalities in templates

This adds support for <, <=, >, >= in templates
Merge pull request #1734 from s-m/1518-inequalities

API: Support inequalities in templates, fixes #1518