APACHE 2.0 STATUS: -*-text-*-
-Last modified at [$Date: 2004/01/12 14:59:16 $]
+Last modified at [$Date: 2004/01/12 15:54:35 $]
Release:
modules/metadata/mod_setenvif.c: r1.44
+1: nd, jerenkrantz
- * mod_autoindex: Allow switching between XHTML and HTML output.
- PR 23747. (minor MMN bump).
- modules/generators/mod_autoindex.c: r1.124
- include/httpd.h: r1.201
- include/ap_mmn.h: r1.60
- jerenkrantz suggests: Why don't we just always output XHTML instead?
- nd replies: backwards compat; it would break those sites who have html
- READMEs or HEADERs (or don't want to use xhtml)
- +1: nd, jerenkrantz, trawick
-
* LDAP cache fixes from Matthieu Estrade; see PR 18756
include/util_ldap.h r1.12
modules/experimental/util_ldap.c r1.15, r1.16
#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
"DTD HTML 4.0 Frameset//EN\"\n" \
"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
+/** XHTML 1.0 Strict Doctype */
+#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
+ "DTD XHTML 1.0 Strict//EN\"\n" \
+ "\"http://www.w3.org/TR/xhtml1/DTD/" \
+ "xhtml1-strict.dtd\">\n"
+/** XHTML 1.0 Transitional Doctype */
+#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
+ "DTD XHTML 1.0 Transitional//EN\"\n" \
+ "\"http://www.w3.org/TR/xhtml1/DTD/" \
+ "xhtml1-transitional.dtd\">\n"
+/** XHTML 1.0 Frameset Doctype */
+#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
+ "DTD XHTML 1.0 Frameset//EN\"\n" \
+ "\"http://www.w3.org/TR/xhtml1/DTD/" \
+ "xhtml1-frameset.dtd\">"
/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
#define TABLE_INDEXING (1 << 14)
#define IGNORE_CLIENT (1 << 15)
#define IGNORE_CASE (1 << 16)
+#define EMIT_XHTML (1 << 17)
#define K_NOADJUST 0
#define K_ADJUST 1
* We include the DOCTYPE because we may be using features therefrom (i.e.,
* HEIGHT and WIDTH attributes on the icons if we're FancyIndexing).
*/
-static void emit_preamble(request_rec *r, char *title)
+static void emit_preamble(request_rec *r, int xhtml, const char *title)
{
- ap_rvputs(r, DOCTYPE_HTML_3_2,
+ ap_rvputs(r, xhtml ? DOCTYPE_XHTML_1_0T : DOCTYPE_HTML_3_2,
"<html>\n <head>\n <title>Index of ", title,
"</title>\n </head>\n <body>\n", NULL);
}
else if (!strcasecmp(w, "VersionSort")) {
option = VERSION_SORT;
}
+ else if (!strcasecmp(w, "XHTML")) {
+ option = EMIT_XHTML;
+ }
else if (!strcasecmp(w, "None")) {
if (action != '\0') {
return "Cannot combine '+' or '-' with 'None' keyword";
* oh well.
*/
static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
- char *title)
+ int emit_xhtml, char *title)
{
apr_table_t *hdrs = r->headers_in;
apr_file_t *f = NULL;
emit_H1 = 0;
if (! suppress_amble) {
- emit_preamble(r, title);
+ emit_preamble(r, emit_xhtml, title);
}
/* This is a hack, but I can't find any better way to do this.
* The problem is that we have already created the sub-request,
*/
if (apr_file_open(&f, rr->filename, APR_READ,
APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
- emit_preamble(r, title);
+ emit_preamble(r, emit_xhtml, title);
emit_amble = 0;
do_emit_plain(r, f);
apr_file_close(f);
}
if (emit_amble) {
- emit_preamble(r, title);
+ emit_preamble(r, emit_xhtml, title);
}
if (emit_H1) {
ap_rvputs(r, "<h1>Index of ", title, "</h1>\n", NULL);
if (d->icon_height) {
ap_rprintf(r, " height=\"%d\"", d->icon_height);
}
- ap_rputs(" /></th>", r);
+
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs("></th>", r);
}
else {
ap_rputs(" </th>", r);
if (!(autoindex_opts & SUPPRESS_RULES)) {
breakrow = apr_psprintf(r->pool,
"<tr><th colspan=\"%d\">"
- "<hr /></th></tr>\n", cols);
+ "<hr%s></th></tr>\n", cols,
+ (autoindex_opts & EMIT_XHTML) ? " /" : "");
}
ap_rvputs(r, "</th></tr>", breakrow, NULL);
}
if (d->icon_height) {
ap_rprintf(r, " height=\"%d\"", d->icon_height);
}
- ap_rputs(" /> ", r);
+
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs("> ", r);
}
else {
ap_rputs(" ", r);
colargs, static_columns);
}
if (!(autoindex_opts & SUPPRESS_RULES)) {
- ap_rputs("<hr />", r);
+ ap_rputs("<hr", r);
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs(">", r);
}
else {
ap_rputc('\n', r);
if (d->icon_height) {
ap_rprintf(r, " height=\"%d\"", d->icon_height);
}
- ap_rputs(" />", r);
+
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs(">", r);
}
else {
ap_rputs(" ", r);
if (d->icon_height) {
ap_rprintf(r, " height=\"%d\"", d->icon_height);
}
- ap_rputs(" />", r);
+
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs(">", r);
}
else {
ap_rputs(" ", r);
}
else if (autoindex_opts & FANCY_INDEXING) {
if (!(autoindex_opts & SUPPRESS_RULES)) {
- ap_rputs("<hr /></pre>\n", r);
+ ap_rputs("<hr", r);
+ if (autoindex_opts & EMIT_XHTML) {
+ ap_rputs(" /", r);
+ }
+ ap_rputs("></pre>\n", r);
}
else {
ap_rputs("</pre>\n", r);
}
emit_head(r, find_header(autoindex_conf, r),
- autoindex_opts & SUPPRESS_PREAMBLE, title_name);
+ autoindex_opts & SUPPRESS_PREAMBLE,
+ autoindex_opts & EMIT_XHTML, title_name);
/*
* Since we don't know how many dir. entries there are, put them into a