Rename template variables to omit leading numbers
The quantity of template variables is about to increase and it's tedious to renumber all subsequent variables just to keep them in numerical order. One of the variables, t_parentdir_entry, already didn't have a leading number, so this change makes the rest of the variables consistent with that.pull/142/head
parent
5930c29d6a
commit
4a6845348b
|
@ -617,10 +617,10 @@ make_header_buf(ngx_http_request_t *r, const ngx_str_t css_href)
|
||||||
{
|
{
|
||||||
ngx_buf_t *b;
|
ngx_buf_t *b;
|
||||||
size_t blen = r->uri.len
|
size_t blen = r->uri.len
|
||||||
+ ngx_sizeof_ssz(t01_head1)
|
+ ngx_sizeof_ssz(t_head1)
|
||||||
+ ngx_sizeof_ssz(t02_head2)
|
+ ngx_sizeof_ssz(t_head2)
|
||||||
+ ngx_sizeof_ssz(t03_head3)
|
+ ngx_sizeof_ssz(t_head3)
|
||||||
+ ngx_sizeof_ssz(t04_body1)
|
+ ngx_sizeof_ssz(t_body1)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (css_href.len) {
|
if (css_href.len) {
|
||||||
|
@ -633,7 +633,7 @@ make_header_buf(ngx_http_request_t *r, const ngx_str_t css_href)
|
||||||
if ((b = ngx_create_temp_buf(r->pool, blen)) == NULL)
|
if ((b = ngx_create_temp_buf(r->pool, blen)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
b->last = ngx_cpymem_ssz(b->last, t01_head1);
|
b->last = ngx_cpymem_ssz(b->last, t_head1);
|
||||||
|
|
||||||
if (css_href.len) {
|
if (css_href.len) {
|
||||||
b->last = ngx_cpymem_str(b->last, css_href_pre);
|
b->last = ngx_cpymem_str(b->last, css_href_pre);
|
||||||
|
@ -641,10 +641,10 @@ make_header_buf(ngx_http_request_t *r, const ngx_str_t css_href)
|
||||||
b->last = ngx_cpymem_str(b->last, css_href_post);
|
b->last = ngx_cpymem_str(b->last, css_href_post);
|
||||||
}
|
}
|
||||||
|
|
||||||
b->last = ngx_cpymem_ssz(b->last, t02_head2);
|
b->last = ngx_cpymem_ssz(b->last, t_head2);
|
||||||
b->last = ngx_cpymem_str(b->last, r->uri);
|
b->last = ngx_cpymem_str(b->last, r->uri);
|
||||||
b->last = ngx_cpymem_ssz(b->last, t03_head3);
|
b->last = ngx_cpymem_ssz(b->last, t_head3);
|
||||||
b->last = ngx_cpymem_ssz(b->last, t04_body1);
|
b->last = ngx_cpymem_ssz(b->last, t_body1);
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
@ -851,17 +851,17 @@ make_content_buf(
|
||||||
|
|
||||||
if (alcf->show_path)
|
if (alcf->show_path)
|
||||||
len = r->uri.len + escape_html
|
len = r->uri.len + escape_html
|
||||||
+ ngx_sizeof_ssz(t05_body2)
|
+ ngx_sizeof_ssz(t_body2)
|
||||||
+ ngx_sizeof_ssz(t06_list1)
|
+ ngx_sizeof_ssz(t_list_begin)
|
||||||
+ ngx_sizeof_ssz(t_parentdir_entry)
|
+ ngx_sizeof_ssz(t_parentdir_entry)
|
||||||
+ ngx_sizeof_ssz(t07_list2)
|
+ ngx_sizeof_ssz(t_list_end)
|
||||||
+ ngx_fancyindex_timefmt_calc_size (&alcf->time_format) * entries.nelts
|
+ ngx_fancyindex_timefmt_calc_size (&alcf->time_format) * entries.nelts
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
len = r->uri.len + escape_html
|
len = r->uri.len + escape_html
|
||||||
+ ngx_sizeof_ssz(t06_list1)
|
+ ngx_sizeof_ssz(t_list_begin)
|
||||||
+ ngx_sizeof_ssz(t_parentdir_entry)
|
+ ngx_sizeof_ssz(t_parentdir_entry)
|
||||||
+ ngx_sizeof_ssz(t07_list2)
|
+ ngx_sizeof_ssz(t_list_end)
|
||||||
+ ngx_fancyindex_timefmt_calc_size (&alcf->time_format) * entries.nelts
|
+ ngx_fancyindex_timefmt_calc_size (&alcf->time_format) * entries.nelts
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1025,11 +1025,11 @@ make_content_buf(
|
||||||
/* Display the path, if needed */
|
/* Display the path, if needed */
|
||||||
if (alcf->show_path){
|
if (alcf->show_path){
|
||||||
b->last = last = (u_char *) ngx_escape_html(b->last, r->uri.data, r->uri.len);
|
b->last = last = (u_char *) ngx_escape_html(b->last, r->uri.data, r->uri.len);
|
||||||
b->last = ngx_cpymem_ssz(b->last, t05_body2);
|
b->last = ngx_cpymem_ssz(b->last, t_body2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the <table> tag */
|
/* Open the <table> tag */
|
||||||
b->last = ngx_cpymem_ssz(b->last, t06_list1);
|
b->last = ngx_cpymem_ssz(b->last, t_list_begin);
|
||||||
|
|
||||||
tp = ngx_timeofday();
|
tp = ngx_timeofday();
|
||||||
|
|
||||||
|
@ -1129,7 +1129,7 @@ make_content_buf(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output table bottom */
|
/* Output table bottom */
|
||||||
b->last = ngx_cpymem_ssz(b->last, t07_list2);
|
b->last = ngx_cpymem_ssz(b->last, t_list_end);
|
||||||
|
|
||||||
*pb = b;
|
*pb = b;
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
|
@ -1259,8 +1259,8 @@ add_builtin_header:
|
||||||
out[last].buf->pos = alcf->footer.local.data;
|
out[last].buf->pos = alcf->footer.local.data;
|
||||||
out[last].buf->last = alcf->footer.local.data + alcf->footer.local.len;
|
out[last].buf->last = alcf->footer.local.data + alcf->footer.local.len;
|
||||||
} else {
|
} else {
|
||||||
out[last].buf->pos = (u_char*) t08_foot1;
|
out[last].buf->pos = (u_char*) t_foot;
|
||||||
out[last].buf->last = (u_char*) t08_foot1 + sizeof(t08_foot1) - 1;
|
out[last].buf->last = (u_char*) t_foot + sizeof(t_foot) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
out[last-1].buf->last_in_chain = 0;
|
out[last-1].buf->last_in_chain = 0;
|
||||||
|
@ -1321,8 +1321,8 @@ add_builtin_header:
|
||||||
if (out[0].buf == NULL)
|
if (out[0].buf == NULL)
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
out[0].buf->memory = 1;
|
out[0].buf->memory = 1;
|
||||||
out[0].buf->pos = (u_char*) t08_foot1;
|
out[0].buf->pos = (u_char*) t_foot;
|
||||||
out[0].buf->last = (u_char*) t08_foot1 + sizeof(t08_foot1) - 1;
|
out[0].buf->last = (u_char*) t_foot + sizeof(t_foot) - 1;
|
||||||
out[0].buf->last_in_chain = 1;
|
out[0].buf->last_in_chain = 1;
|
||||||
out[0].buf->last_buf = 1;
|
out[0].buf->last_buf = 1;
|
||||||
/* Directly send out the builtin footer */
|
/* Directly send out the builtin footer */
|
||||||
|
|
32
template.h
32
template.h
|
@ -1,5 +1,5 @@
|
||||||
/* Automagically generated, do not edit! */
|
/* Automagically generated, do not edit! */
|
||||||
static const u_char t01_head1[] = ""
|
static const u_char t_head1[] = ""
|
||||||
"<!DOCTYPE html>"
|
"<!DOCTYPE html>"
|
||||||
"<html>"
|
"<html>"
|
||||||
"<head>"
|
"<head>"
|
||||||
|
@ -44,24 +44,24 @@ static const u_char t01_head1[] = ""
|
||||||
"</style>"
|
"</style>"
|
||||||
"\n"
|
"\n"
|
||||||
;
|
;
|
||||||
static const u_char t02_head2[] = ""
|
static const u_char t_head2[] = ""
|
||||||
"\n"
|
"\n"
|
||||||
"<title>Index of "
|
"<title>Index of "
|
||||||
;
|
;
|
||||||
static const u_char t03_head3[] = ""
|
static const u_char t_head3[] = ""
|
||||||
"</title>"
|
"</title>"
|
||||||
"\n"
|
"\n"
|
||||||
"</head>"
|
"</head>"
|
||||||
;
|
;
|
||||||
static const u_char t04_body1[] = ""
|
static const u_char t_body1[] = ""
|
||||||
"<body>"
|
"<body>"
|
||||||
"<h1>Index of "
|
"<h1>Index of "
|
||||||
;
|
;
|
||||||
static const u_char t05_body2[] = ""
|
static const u_char t_body2[] = ""
|
||||||
"</h1>"
|
"</h1>"
|
||||||
"\n"
|
"\n"
|
||||||
;
|
;
|
||||||
static const u_char t06_list1[] = ""
|
static const u_char t_list_begin[] = ""
|
||||||
"<table id=\"list\">"
|
"<table id=\"list\">"
|
||||||
"<thead>"
|
"<thead>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
|
@ -81,22 +81,22 @@ static const u_char t_parentdir_entry[] = ""
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"\n"
|
"\n"
|
||||||
;
|
;
|
||||||
static const u_char t07_list2[] = ""
|
static const u_char t_list_end[] = ""
|
||||||
"</tbody>"
|
"</tbody>"
|
||||||
"</table>"
|
"</table>"
|
||||||
;
|
;
|
||||||
static const u_char t08_foot1[] = ""
|
static const u_char t_foot[] = ""
|
||||||
"</body>"
|
"</body>"
|
||||||
"</html>"
|
"</html>"
|
||||||
;
|
;
|
||||||
#define NFI_TEMPLATE_SIZE (0 \
|
#define NFI_TEMPLATE_SIZE (0 \
|
||||||
+ nfi_sizeof_ssz(t01_head1) \
|
+ nfi_sizeof_ssz(t_head1) \
|
||||||
+ nfi_sizeof_ssz(t02_head2) \
|
+ nfi_sizeof_ssz(t_head2) \
|
||||||
+ nfi_sizeof_ssz(t03_head3) \
|
+ nfi_sizeof_ssz(t_head3) \
|
||||||
+ nfi_sizeof_ssz(t04_body1) \
|
+ nfi_sizeof_ssz(t_body1) \
|
||||||
+ nfi_sizeof_ssz(t05_body2) \
|
+ nfi_sizeof_ssz(t_body2) \
|
||||||
+ nfi_sizeof_ssz(t06_list1) \
|
+ nfi_sizeof_ssz(t_list_begin) \
|
||||||
+ nfi_sizeof_ssz(t_parentdir_entry) \
|
+ nfi_sizeof_ssz(t_parentdir_entry) \
|
||||||
+ nfi_sizeof_ssz(t07_list2) \
|
+ nfi_sizeof_ssz(t_list_end) \
|
||||||
+ nfi_sizeof_ssz(t08_foot1) \
|
+ nfi_sizeof_ssz(t_foot) \
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!-- var t01_head1 -->
|
<!-- var t_head1 -->
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -42,24 +42,24 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- var t02_head2 -->
|
<!-- var t_head2 -->
|
||||||
|
|
||||||
<title>Index of
|
<title>Index of
|
||||||
<!-- var NONE -->
|
<!-- var NONE -->
|
||||||
/path/to/somewhere
|
/path/to/somewhere
|
||||||
<!-- var t03_head3 -->
|
<!-- var t_head3 -->
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<!-- var t04_body1 -->
|
<!-- var t_body1 -->
|
||||||
<body>
|
<body>
|
||||||
<h1>Index of
|
<h1>Index of
|
||||||
<!-- var NONE -->
|
<!-- var NONE -->
|
||||||
/path/to/somewhere
|
/path/to/somewhere
|
||||||
<!-- var t05_body2 -->
|
<!-- var t_body2 -->
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<!-- var t06_list1 -->
|
<!-- var t_list_begin -->
|
||||||
<table id="list">
|
<table id="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -93,9 +93,9 @@
|
||||||
<td>666</td>
|
<td>666</td>
|
||||||
<td>date</td>
|
<td>date</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- var t07_list2 -->
|
<!-- var t_list_end -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<!-- var t08_foot1 -->
|
<!-- var t_foot -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue