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: * Alternative implementation:
* *b->last++ = (i & 0x01) ? 'e' : 'o'; * *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) { if (entry[i].escape) {
ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len, ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len,

8
template.awk

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

35
template.h

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

23
template.html

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

Loading…
Cancel
Save