The quest for valid HTML
Alexander Bartolich <[email protected]> Mon, 17 Nov 2003 22:30:28 +0100
| Newsgroups | gmane.comp.cms.phpslash.devel |
|---|---|
| Message-ID | <[email protected]> |
http://validator.w3.org/ does not like the HTML produced by
phpSlash-0.7.2,
due to three problems:
1. The templates contain xml-style tags like <br/>
2. Use of multiple IDs instead of class names,
e.g. several <div id="fancyBox"> on one page
3. Writing plain & instead of & in generated URLS,
e.g. &slashSess= or
Anyway, this mail is only about the first problem.
According to
find . -type f -name '*.tpl' | xargs grep -i 'doctype' \
| sed -e /Transitional/d -e 's/:.*//'
there are 10 files with an explicit non-html doctype:
./public_html/templates/en/basic/article-wml.tpl
./public_html/templates/en/basic/article-xhtmlb.tpl
./public_html/templates/en/basic/backendRSS91.tpl
./public_html/templates/en/basic/backendWml.tpl
./public_html/templates/en/basic/backendXHTMLb.tpl
./public_html/templates/en/default/article-wml.tpl
./public_html/templates/en/default/article-xhtmlb.tpl
./public_html/templates/en/default/backendRSS91.tpl
./public_html/templates/en/default/backendWml.tpl
./public_html/templates/en/default/backendXHTMLb.tpl
Since I use none of the fancy CMS-like features I can only
guess that the rest is plain HTML. My recommended procedure
is to apply a global search-and-replace and then throw away
above files before doing a commit.
find . -type f -name '*.tpl' | xargs ./subst
where 'subst' is
perl -p -i.bak \
-e 's#<\s*(\w)\s*/>#<$1>#g;' \
-e 's#"\s*/>#">#g;' \
-e 's#http://www.phpslash.org#http://phpslash.sourceforge.net#g'
The first expressions handles plains tags like
<br />
where there is a single tag-name between angle brackets.
The second one handles the cyclops smiley "/> that appears in
<input type="submit" name="submit" value="Submit" />
The third one is long overdue.
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl