[Fwd: patch to make hypermail generate valid xhtml]

From: Zvi Har'El <rl_at_math.technion.ac.il_at_hypermail-project.org>
Date: Sat, 10 Nov 2007 23:32:43 +0200
Message-ID: <4736237B.5000005_at_math.technion.ac.il>

Hi,

I noticed that the current hypermail code doesn't generate valid XHTML 1.0 because of two reasons:

  1. it uses numeric id's for messages. The id attribute in XML cannot be numeric. This is may fixed by prefixing all the numeric id's by a common string, say 'msg'.
  2. it has <p> start tag with no </p> end tag. This happens when the source has an empty line, which is assumed to mean a paragraph break. This may be fixed to replace these brakes by <br />.

I attach a patch which does exactly these two things, in src/print.c and src/threadprint.c. It is generated by 'cvs diff -u >hypermail.patch', and may be easily applied using 'patch -p0 <hypermail.patch'.

Best,

Zvi.

-- 
Dr. Zvi Har'El      mailto:rl_at_math.technion.ac.il    Department of Mathematics
tel:+972-54-4227607                  Technion - Israel Institute of Technology
fax:+972-4-8293388  http://www.math.technion.ac.il/~rl/    Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)




-- 
Dr. Zvi Har'El      mailto:rl_at_math.technion.ac.il    Department of Mathematics
tel:+972-54-4227607                  Technion - Israel Institute of Technology
fax:+972-4-8293388  http://www.math.technion.ac.il/~rl/    Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)




Index: print.c =================================================================== RCS file: /CVS/hypermail/src/print.c,v retrieving revision 1.116 diff -u -r1.116 print.c --- print.c 1 Oct 2007 21:29:01 -0000 1.116 +++ print.c 8 Nov 2007 19:48:03 -0000
_at_@ -302,19 +302,19 @@
fprintf (fp, "<a name=\"%s\" id=\"%s\"></a>",id,id); fprintf(fp, "<dfn>%s</dfn>:", lang[MSG_CONTEMPORARY_MSGS_SORTED]); if (show_index[dlev][DATE_INDEX]) - fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", + fprintf(fp, " [ <a href=\"%s#msg%d\" title=\"%s\">%s</a> ]", index_name[dlev][DATE_INDEX], num, lang[MSG_LTITLE_BY_DATE], lang[MSG_BY_DATE]); if (show_index[dlev][THREAD_INDEX]) - fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", + fprintf(fp, " [ <a href=\"%s#msg%d\" title=\"%s\">%s</a> ]", index_name[dlev][THREAD_INDEX], num, lang[MSG_LTITLE_BY_THREAD], lang[MSG_BY_THREAD]); if (show_index[dlev][SUBJECT_INDEX]) - fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", + fprintf(fp, " [ <a href=\"%s#msg%d\" title=\"%s\">%s</a> ]", index_name[dlev][SUBJECT_INDEX], num, lang[MSG_LTITLE_BY_SUBJECT], lang[MSG_BY_SUBJECT]); if (show_index[dlev][AUTHOR_INDEX]) - fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", + fprintf(fp, " [ <a href=\"%s#msg%d\" title=\"%s\">%s</a> ]", index_name[dlev][AUTHOR_INDEX], num, lang[MSG_LTITLE_BY_AUTHOR], lang[MSG_BY_AUTHOR]); if (show_index[dlev][ATTACHMENT_INDEX])
_at_@ -808,7 +808,7 @@
subj_tag = ""; subj_end_tag = ""; } - fprintf(fp,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"%d\" id=\"%d\"><em>%s</em></a>%s%s%s\n", + fprintf(fp,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"msg%d\" id=\"msg%d\"><em>%s</em></a>%s%s%s\n", startline, msg_href(em, subdir_email, FALSE), subj_tag, subj, subj_end_tag, break_str, em->msgnum, em->msgnum, tmpptr=convchars(em->name,em->charset), break_str, date_str, endline);
_at_@ -850,11 +850,11 @@
/* consider that if there's an attachment directory, there are attachments */ nb_attach++; if (set_indextable) { - fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"%d\" id=\"%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, em->msgnum, tmpptr=convchars(em->name,em->charset), getindexdatestr(em->date)); + fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"msg%d\" id=\"msg%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, em->msgnum, tmpptr=convchars(em->name,em->charset), getindexdatestr(em->date)); } else { fprintf(fp, "<li>%s%s<dfn>%s</dfn></a>&nbsp;" - "<a name=\"%d\" id=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", + "<a name=\"msg%d\" id=\"msg%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", (*is_first) ? first_attributes : "", msg_href(em, subdir_email, TRUE), subj, em->msgnum, em->msgnum, tmpptr=convchars(em->name,em->charset), getindexdatestr(em->date));
_at_@ -1271,7 +1271,7 @@
fprintf(fp, "</pre>\n"); pre = FALSE; } - fprintf(fp, "<p>\n"); + fprintf(fp, "<br />\n"); } else { if (!pre) {
_at_@ -1322,7 +1322,7 @@
Akis Karnouskos <akis_at_ceid.upatras.gr> */ { if (!pre) - fprintf(fp, "<p>"); + fprintf(fp, "<br />"); } else { if (insig) {
_at_@ -2634,7 +2634,7 @@
endline = "</li>"; } fprintf(fp, - "%s%s%s</a>%s <a name=\"%d\" id=\"%d\">%s</a>%s\n", startline, + "%s%s%s</a>%s <a name=\"msg%d\" id=\"msg%d\">%s</a>%s\n", startline, msg_href(hp->data, subdir_email, TRUE), tmpptr=convchars(hp->data->name,hp->data->charset), break_str, hp->data->msgnum, hp->data->msgnum, date_str, endline); *oldsubject = hp->data->unre_subject;
_at_@ -2788,7 +2788,7 @@
snprintf(date_str, sizeof(date_str), "<em>(%s)</em>", getindexdatestr(hp->data->date)); endline = "</li>"; } - fprintf(fp,"%s%s%s</a>%s<a name=\"%d\" id=\"%d\">%s</a>%s\n", + fprintf(fp,"%s%s%s</a>%s<a name=\"msg%d\" id=\"msg%d\">%s</a>%s\n", startline, msg_href(hp->data, subdir_email, TRUE), subj, break_str, hp->data->msgnum, hp->data->msgnum, date_str, endline); if(subj) Index: threadprint.c =================================================================== RCS file: /CVS/hypermail/src/threadprint.c,v retrieving revision 1.24 diff -u -r1.24 threadprint.c --- threadprint.c 4 Nov 2005 06:57:29 -0000 1.24 +++ threadprint.c 8 Nov 2007 19:48:03 -0000
_at_@ -279,7 +279,7 @@
if (set_indextable) { fprintf(fp, "<tr><td>%s<a href=\"%s\"%s><strong>%s</strong></a></td>" - "<td nowrap><a name=\"%d\" id=\"%d\">%s</a></td>" "<td nowrap>%s</td></tr>\n", + "<td nowrap><a name=\"msg%d\" id=\"msg%d\">%s</a></td>" "<td nowrap>%s</td></tr>\n", level > 1 ? "--&gt; " : "", href, first_attributes, subj, email->msgnum, email->msgnum, tmpname, getindexdatestr(email->date));
_at_@ -290,7 +290,7 @@
num_open_li[level]--; } fprintf(fp, "<li><a href=\"%s\"%s>%s</a>&nbsp;" - "<a name=\"%d\" id=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", + "<a name=\"msg%d\" id=\"msg%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", href, first_attributes, subj, email->msgnum, email->msgnum, tmpname, getindexdatestr(email->date)); }
Received on Sun 11 Nov 2007 06:18:06 AM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:13 AM GMT GMT