Hello vim-dev,

I really liked the "Convert to HTML" function in gvim, but wished that
it could be a little more "correct"  in terms of the w3 standard. So I
wrote a patch. Here is an outline of what I have done:

- The script used to only declare a <!DOCTYPE> if CSS was enabled
(html_use_css). All (X)HTML documents parsed by a browser should contain
a doctype. I modified the script so as to always include a doctype.

- You cannot put <font> tags in a <pre> according to w3, so I have
forced html_no_pre if CSS is disabled. The original value of html_no_pre
is restored when execution 2html.vim is complete.

- I have changed DOCTYPE's (both HTML/XHTML)  to transitional because
(X)HTML strict disallows tags like bgcolor, link, alink and vlink in the
<body> tag.

- I removed <p>'s because you cannot contain a <span> in a <p> according
to w3. An unstyled <p> would make no difference in this case anyway.

I have tested my work on opera 9.01 and Mozilla 1.7.13 on an OpenBSD
4.0-beta snapshot(about 2 weeks old), and all pages seem to look
identical to before my modifications, but this time they pass w3's
validation (http://validator.w3.org).

So... I went forth and emailed a patch to the maintainer (bram@), who
casted his doubt as to whether this was the right thing to do, as
browsers usually don't support w3's standards, and also beacuse I have
only tested on 2 browsers.

He reccommended I post a patch to vim-dev@ asking for testing and
opinions, so here I am.

Here is the patch: http://arameus.net/users/edd/vim-test/2html.vim.diff

Also in the same directory you will see the output of my tests, please
test them on other browsers.

I am completely new to your development community (but I've been using
vim for many years), so I aplogize if I have broken any coding style
rules/other rules. =)

Best Regards

Edd

Reply via email to