Closed agentzh closed 6 years ago
Maybe we should use tools to do this edit otherwise it would be too much work considering the coding style :)
Agreed. Actually, there are couple of forms that appears very often in the templates. I think we can make the templates much easier to write by creating specific template directives for those:
http
subsystem[% IF subsystem == "http" %]
[% END %]
[% HTTP %]
[% END %]
stream
subsystem[% IF subsystem == "stream" %]
[% END %]
[% STREAM %]
[% END %]
http
subsystem with else[% IF subsystem == "http" %]
[% ELSIF subsystem == "stream" %]
[% END %]
[% HTTP %]
[% ELSE %]
[% END %]
#define NGX_[% subsystem FILTER upper %]_FOO_BAR
#define NGX_[% SUBSYS %]_FOO_BAR
I don't think replacing them will be terribly difficult though. Most of those use cases are very consistent and should be a matter of sed
ing all occurrences. If we can get rid of just the ones listed here plus renaming subsystem
to subsys
, the template's readability will definitely become a lot better.
@agentzh What's your opinion on this?
@dndx Well, we still need to make it valid TT2 syntax. This is not bad:
[% IF http_subsys %]
[% ELSIF stream_subsys %]
[% END %]
And indeed, [% subsystem FILTER upper %]
should die and get replaced by [% SUBSYS %]
.
Already done once #22 is merged.
The word "subsystem" is too long and too heavy and appears so many times in all the templates and directory and file names. Let's abbreviate it to "subsys". Also, there is all-upper-case form like the
SUBSYSTEM
tt2 variable.