Quirks to Transitional tool

M

Martin Rinehart

I decided to upgrade my sites from quirks to transitional. To help, I
wrote a little program that proved extremely handy:

http://www.martinrinehart.com/examples/quirks2loose.html

It comes with a few regex search/replace specs and lets you easily add
more as needed. I converted and validated about 400 pages in 20 hours.

You are welcome to use this as a service on my site. If you want to
use it a lot, please grab the code and run it on your machine.

I've not tried it, but my guess is that it would be equally helpful
for loose to strict conversion.
 
T

Thomas 'PointedEars' Lahn

Martin said:
I decided to upgrade my sites from quirks to transitional.

You seem to have adopted strange notions about DOCTYPE declarations and
their correspondence with render modes to begin with.

A DOCTYPE declaration with or without system identifier (DTD URI) specifies
against which DTD the document is supposed to validate. If the system
identifier is missing, a UA is supposed to match against a catalog of
public identifiers in order to determine the system identifier.

Roughly speaking, the difference between Quirks/Compatibility Mode and
Standards Compliance Mode is that the latter is triggered if the correct
system identifier is provided. In all other cases, the former is
triggered.

It is _not_ as if there was a evolutionary hierarchy as you indicate here,
like

Quirks --> Transitional (loose) --> Strict

See also said:
To help, I wrote a little program that proved extremely handy:
[...]
I've not tried it, but my guess is that it would be equally helpful
for loose to strict conversion.

This wheel has already been invented: <http://tidy.sourceforge.net/>
(I use EclipseTidy when necessary.)


PointedEars
 
M

Martin Rinehart

This wheel has already been invented: <http://tidy.sourceforge.net/>
(I use EclipseTidy when necessary.)

Tidy is about 500kB of C. My little tool is 13kB of HTML and
JavaScript, including the 3kB quick regex reference. Mine is handy for
those who know regex and want to, for example, replace 'height=nn'
with 'style="height:nnpx"'.
 
T

Thomas 'PointedEars' Lahn

Martin said:
Tidy is about 500kB of C.

The compiled version requires about 42 KiB *on my harddisk* along with
documentation, installed with `aptitude install tidy'. EclipseTidy
requires 292'605 bytes, but it has the virtue of integrating seemlessly
with my IDE.
My little tool is 13kB of HTML and JavaScript,

Not surprising, considering that it can do considerably less.
Unfortunately, it also takes much more time for doing that
("400 pages in *20* hours"?).
including the 3kB quick regex reference. Mine is handy for those
who know regex and want to, for example, replace 'height=nn'
with 'style="height:nnpx"'.

Have you considered "height=nn%"?

It did not replace <table height="50"> and <table height=50> with
<table style="height: 50px">. It did replace <table height=50> with
<table style='height: 50'>, which is invalid CSS.

It forces UTF-8 (what for?) but does not convert to character (entity)
references in the document.

You have not escaped all ETAGOs (</) in the source code. (You would not
need to do that, had you used an external script file.)

And ^G caused my Iceweasel to start searching backwards (I told you).

Rest assured I'll consider your program as soon as it can clean up and save
the file in one step.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top