- From: Richard A. O'Keefe <ok@atlas.otago.ac.nz>
- Date: Mon, 7 Aug 2000 15:31:16 +1200 (NZST)
- To: html-tidy@w3.org, rossen@freesurf.ch
Erik Rossen <rossen@freesurf.ch> asked: Now what about zero-padding slide numbers with %03d? :-) Here are patches to the July release that should do the right thing. This change *has* been tested, but not very thoroughly. ------- pprint.c ------- 13a14,29 > /* Slides are split into files whose names have the form > "slide" & slide_number & ".html". > Originally, this was done in effect by "slide%d.html"; > now it is done by "slide%0*d.html", slide_min_digits, > because it is more convenient for wild-card file naming > if all the file names have the same length. > The original behaviour can be restored by setting > slide_min_digits to 1. > > Most unfortunately, the naming convention is not encapsulated > in a single function. Next time this is visted, refactor. > A revisit is needed anyway, because this should be in the options file. > It isn't yet, because the change should be harmless. > */ > static int slide_min_digits = 3; > 843c859 < for (p = node->element; (c = *p); ++p) --- > for (p = node->element; (c = *p) != 0; ++p) 1567c1583,1584 < sprintf(buf, "<a href=\"slide%d.html\">previous</a> | ", slide-1); --- > sprintf(buf, "<a href=\"slide%0*d.html\">previous</a> | ", > slide_min_digits, slide-1); 1572,1575c1589,1594 < PPrintString(fout, indent , "<a href=\"slide1.html\">start</a> | "); < else < PPrintString(fout, indent , "<a href=\"slide1.html\">start</a>"); < --- > sprintf(buf, "<a href=\"slide%0*d.html\">start</a> | ", > slide_min_digits, 1); > else > sprintf(buf, "<a href=\"slide%0*d.html\">start</a>", > slide_min_digits, 1); > PPrintString(fout, indent, buf); 1581c1600,1601 < sprintf(buf, "<a href=\"slide%d.html\">next</a>", slide+1); --- > sprintf(buf, "<a href=\"slide%0*d.html\">next</a>", > slide_min_digits, slide+1); 1601,1602c1621,1622 < sprintf(buf, "<div onclick=\"document.location='slide%d.html'\">", < (slide < count ? slide + 1 : 1)); --- > sprintf(buf, "<div onclick=\"document.location='slide%0*d.html'\">", > slide_min_digits, (slide < count ? slide + 1 : 1)); 1731c1751 < sprintf(buf, "slide%d.html", slide); --- > sprintf(buf, "slide%0*d.html", slide_min_digits, slide); 1752c1772 < sprintf(buf, "slide%d.html", slide); --- > sprintf(buf, "slide%0*d.html", slide_min_digits, slide);
Received on Sunday, 6 August 2000 23:31:24 UTC