Use %f() string syntax in templates

If `%f()` string syntax is available in the current Ruby, we should use it.