Factor out `get_rule`

This just make it slightly more obvious how `render_template` works, and
adds another seam for testing.