Browse Source

- It is ALIVE.

pull/4/head
Adrian Perez 17 years ago
parent
commit
855adc70eb
  1. 2
      ngx_http_fancyindex_module.c
  2. 8
      template.awk
  3. 35
      template.h
  4. 23
      template.html

2
ngx_http_fancyindex_module.c

@ -529,7 +529,7 @@ skip_readme_top:
* Alternative implementation:
* *b->last++ = (i & 0x01) ? 'e' : 'o';
*/
b->last = nfi_cpymem_ssz(b->last, "\"><a href=\"");
b->last = nfi_cpymem_ssz(b->last, "\"><td><a href=\"");
if (entry[i].escape) {
ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len,

8
template.awk

@ -25,6 +25,12 @@ BEGIN {
next;
}
/^$/ {
if (!varname) next;
print "\"\\n\"";
next;
}
{
if (!varname) next;
# Order matters
@ -39,7 +45,7 @@ END {
if (varname) print ";";
print "#define NFI_TEMPLATE_SIZE (0 \\";
for (var in vars) {
print "\t+ nfi_sizeof_ssz(" var ") \\";
print "\t+ nfi_sizeof_ssz(" vars[var] ") \\";
}
print "\t)"
}

35
template.h

@ -1,14 +1,17 @@
/* Automagically generated, do not edit! */
static const u_char t01_head1[] = ""
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
"\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">"
"\n"
"<head>"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>"
"<style type=\"text/css\">"
"<style type=\"text/css\" media=\"screen\">"
"\n"
"body,html {"
"background:#fff;"
"}"
"tr.o {"
"tr.e {"
"background:#f4f4f4;"
"}"
"th,td {"
@ -30,27 +33,34 @@ static const u_char t01_head1[] = ""
"a:hover {"
"color:#e33;"
"}"
"\n"
"</style>"
"\n"
"<title>Index of "
;
static const u_char t02_head2[] = ""
"</title>"
"\n"
"</head>"
;
static const u_char t03_body1[] = ""
"<body>"
"\n"
"<h1>Index of "
;
static const u_char t04_body2[] = ""
"</h1>"
"\n"
;
static const u_char t05_list1[] = ""
"<table id=\"list\" cellpadding=\"0.1em\" cellspacing=\"0\">"
"\n"
"<colgroup>"
"<col width=\"55%\"/>"
"<col width=\"20%\"/>"
"<col width=\"25%\"/>"
"</colgroup>"
"\n"
"<thead>"
"<tr>"
"<th>File Name</th>"
@ -58,8 +68,9 @@ static const u_char t05_list1[] = ""
"<th>Date</th>"
"</tr>"
"</thead>"
"\n"
"<tbody>"
"<tr class=\"e\">"
"<tr class=\"o\">"
"<td><a href=\"../\">Parent directory/</a></td>"
"<td>-</td>"
"<td>-</td>"
@ -78,13 +89,13 @@ static const u_char t09_foot1[] = ""
"</html>"
;
#define NFI_TEMPLATE_SIZE (0 \
+ nfi_sizeof_ssz(4) \
+ nfi_sizeof_ssz(5) \
+ nfi_sizeof_ssz(6) \
+ nfi_sizeof_ssz(7) \
+ nfi_sizeof_ssz(8) \
+ nfi_sizeof_ssz(0) \
+ nfi_sizeof_ssz(1) \
+ nfi_sizeof_ssz(2) \
+ nfi_sizeof_ssz(3) \
+ nfi_sizeof_ssz(t05_list1) \
+ nfi_sizeof_ssz(t06_list2) \
+ nfi_sizeof_ssz(t07_body3) \
+ nfi_sizeof_ssz(t08_body4) \
+ nfi_sizeof_ssz(t09_foot1) \
+ nfi_sizeof_ssz(t01_head1) \
+ nfi_sizeof_ssz(t02_head2) \
+ nfi_sizeof_ssz(t03_body1) \
+ nfi_sizeof_ssz(t04_body2) \
)

23
template.html

@ -1,13 +1,16 @@
<!-- var t01_head1 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type="text/css">
<style type="text/css" media="screen">
body,html {
background:#fff;
}
tr.o {
tr.e {
background:#f4f4f4;
}
th,td {
@ -29,27 +32,34 @@
a:hover {
color:#e33;
}
</style>
<title>Index of
<!-- var NONE -->
/path/to/somewhere
<!-- var t02_head2 -->
</title>
</head>
<!-- var t03_body1 -->
<body>
<h1>Index of
<!-- var NONE -->
/path/to/somewhere
<!-- var t04_body2 -->
</h1>
<!-- var t05_list1 -->
<table id="list" cellpadding="0.1em" cellspacing="0">
<colgroup>
<col width="55%"/>
<col width="20%"/>
<col width="25%"/>
</colgroup>
<thead>
<tr>
<th>File Name</th>
@ -57,24 +67,25 @@
<th>Date</th>
</tr>
</thead>
<tbody>
<tr class="e">
<tr class="o">
<td><a href="../">Parent directory/</a></td>
<td>-</td>
<td>-</td>
</tr>
<!-- var NONE -->
<tr class="o">
<tr class="e">
<td>test file 1</td>
<td>123kB</td>
<td>date</td>
</tr>
<tr class="e">
<tr class="o">
<td>test file 2</td>
<td>321MB</td>
<td>date</td>
</tr>
<tr class="o">
<tr class="e">
<td>test file 3</td>
<td>666</td>
<td>date</td>

Loading…
Cancel
Save