W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

two "-slides" bugs and one fix

From: Erik Rossen <rossen@freesurf.ch>
Date: Wed, 2 Aug 2000 09:16:44 +0200 (MEST)
To: html-tidy@w3.org
Message-ID: <Pine.LNX.4.21.0007312203280.7314-100000@laptop.rossen.ch>
Hash: SHA1

I've been using the "-slides" option in tidy8jul00 the last few days and
I've come across two bugs.

The first bug is that Tidy will segfault if there is no <BODY> level
content before the first <H2> marker.  Try it yourself and see.  I use the
following tidy.conf file:

wrap: 80
wrap-attibutes: no
markup: yes
quote-ampersand: no
break-before-br: yes
uppercase-tags: yes
uppercase-attributes: yes
char-encoding: latin1
tidy-mark: no
doctype: strict
enclose-text: yes
new-inline-tags: blink

on the following test.html file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<TITLE>tidy -slides test page</TITLE>

<H2>Subtitle A</H2>

<P>Some text about "A".</P>

<H2>Subtitle B</H2>

<P>Some text about "B".</P>

"tidy -slides test.html" segfaults.

If you put some content between <BODY> and <H2>, Tidy will work just fine.

I am running SuSE6.4 Linux 2.2.14 - i586.

The second bug (actually a buglet) is that slides are not numbered in
zero-padded format.  This is not a problem if you have less than 9 slides
or you are not using scripts to extract information out of the resulting
slide files, but if you have 85 slides and you want to construct a table
of contents, it is annoying that "39" comes before "4" in file listings.

I ran the following two lines on pprint.c:

perl -i -p -e 's/slide1.html/slide001.html/' pprint.c
perl -i -p -e 's/slide%d.html/slide%03d.html/' pprint.c

and now I won't have any problems unless I have more than one thousand
slides (heaven forbid!).  Running diff -u1 gives the following patch:

diff -u1 tidy8jul00/pprint.c tidy/pprint.c
- --- tidy8jul00/pprint.c	Sat Jul  8 20:24:07 2000
+++ tidy/pprint.c	Mon Jul 31 13:14:35 2000
@@ -1566,3 +1566,3 @@
- -        sprintf(buf, "<a href=\"slide%d.html\">previous</a> | ", slide-1);
+        sprintf(buf, "<a href=\"slide%03d.html\">previous</a> | ", slide-1);
         PPrintString(fout, indent , buf);
@@ -1571,5 +1571,5 @@
         if (slide < count)
- -            PPrintString(fout, indent , "<a href=\"slide1.html\">start</a> | ");
+            PPrintString(fout, indent , "<a href=\"slide001.html\">start</a> | ");
- -            PPrintString(fout, indent , "<a href=\"slide1.html\">start</a>");
+            PPrintString(fout, indent , "<a href=\"slide001.html\">start</a>");
@@ -1580,3 +1580,3 @@
- -        sprintf(buf, "<a href=\"slide%d.html\">next</a>", slide+1);
+        sprintf(buf, "<a href=\"slide%03d.html\">next</a>", slide+1);
         PPrintString(fout, indent , buf);
@@ -1600,3 +1600,3 @@
     /* insert div for onclick handler */
- -    sprintf(buf, "<div onclick=\"document.location='slide%d.html'\">",
+    sprintf(buf, "<div onclick=\"document.location='slide%03d.html'\">",
                     (slide < count ? slide + 1 : 1));
@@ -1730,3 +1730,3 @@
- -        sprintf(buf, "slide%d.html", slide);
+        sprintf(buf, "slide%03d.html", slide);
         out.state = FSM_ASCII;
@@ -1751,3 +1751,3 @@
- -        sprintf(buf, "slide%d.html", slide);
+        sprintf(buf, "slide%03d.html", slide);

If you are curious to see what one of these slide shows looks like, check
out http://www.multimania.com/rossen/australia/slide001.html.  Note that
the table of contents was constructed and inserted into the first slide
using a script, not Tidy.

A philosophical question for Dave:
Wouldn't it be better to have the "-slides" function in it's own little
program (like the tab2space utility)?  It doesn't have much to do with
making HTML tidy...


Erik Rossen                         ^
rossen@freesurf.ch                 /e\
http://www.multimania.com/rossen   ---   GPG key ID: 2935D0B9

Version: GnuPG v1.0.0 (GNU/Linux)
Comment: Made with pgp4pine 1.75

Received on Wednesday, 2 August 2000 03:47:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:48 UTC