[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

XHTML problem in htmlfixup



Hi ppl,

Recently started wondering if my companies website would do great
in XHTML, so i changed the doctypes, and started using
'wml -W2,-X1034' so the trailing '<br />' wouldn't be deleted.
That worked, so far so good.

Now the problem, some files have <img> tags in them, where
I rely on wml to add the proper width and height attributes.
This however fails in XHTML mode, the check does not allow
for a space before the />, and the result becomes:
	<img src="..." alt="" width="100" height="100/">
                                                  ^^^^^ oops

Setting "-W7,-v" proved this:
	started with)  <img src="..." />
	after imgalt)  <img src="..." alt=""/>
	after imgsize) <img src="..." alt="" width=100 height=100/>
	after quotes)  <img src="..." alt="" width="100" height="100/">

I fixed it by making sure the space is required with the /> too.
(patch attached) but I'm not sure this is entirly the right way.
(And quite sure there will be more places to fix)

    Met vriendelijke groet,
        Pauline Middelink
-- 
GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA  BD3B 9A50 B416 E2D0 C3C2
For more details look at my website http://www.polyware.nl/~middelink
--- htmlfix.src	Sat Sep 16 01:06:30 2000
+++ /usr/lib/wml/exec/wml_p7_htmlfix	Sun Feb 25 17:34:51 2001
@@ -205,7 +205,7 @@
 }
 sub Fixup_imgalt {
     $bufferN = '';
-    while ($buffer =~ s|^(.*?)(<[iI][mM][gG]\s+)([^>]+?)(/?>)||s) {
+    while ($buffer =~ s|^(.*?)(<[iI][mM][gG]\s+)([^>]+?)(( /)?>)||s) {
         ($pre, $tag, $attr, $end) = ($1, $2, $3, $4);
         if (    $attr !~ m|ALT\s*=\s*"[^"]*"|is
             and $attr !~ m|ALT\s*=\s*\S+|is) {
@@ -218,7 +218,7 @@
 }
 sub Fixup_imgsize {
     $bufferN = '';
-    while ($buffer =~ s|^(.*?)(<[iI][mM][gG]\s+)([^>]+?)(/?>)||s) {
+    while ($buffer =~ s|^(.*?)(<[iI][mM][gG]\s+)([^>]+?)(( /)?>)||s) {
         ($pre, $tag, $attr, $end) = ($1, $2, $3, $4);
         $bufferN .= $pre . $tag . &ProcessImgTag($attr) . $end;
     }
@@ -233,7 +233,7 @@
 
     my $last = 0;
     $bufferN = '';
-    while ($buffer =~ m|\G(.*?)(<[tT][aA][bB][lL][eE])([^>]*?)(/?>)|gs) {
+    while ($buffer =~ m|\G(.*?)(<[tT][aA][bB][lL][eE])([^>]*?)(( /)?>)|gs) {
         $last = pos($buffer);
         ($pre, $begin, $attr, $end) = ($1, $2, $3, $4);
 
@@ -404,136 +404,5 @@
 $out->close;
 
 exit(0);