Re: Patch for "HTML5" support
Geoff McLane <[email protected]> Thu, 19 Jan 2012 20:01:55 +0100
| Newsgroups | gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <1326999715.1875.3.camel@DELL02> |
Hi,
Am getting into difficulty... with both the
'version' reported, and with the
<noscript><meta statement...>...
from the git 'issues'...
1. Info: version output
/* examine <!DOCTYPE> to identify version */
In static uint FindGivenVersion(...) added
if (!fpi && !TY_(GetattrByName)(doctype, "SYSTEM")) {
// set TidyXmlOut, TidyXhtmlOut and lexer->isvoyager
and return VERS_HTML5;
which gets stored in lexer->doctype... VERS_HTML5 is
defined as (HT50|XH50).
BUT, now I get -
Info: Document contents look like XHTML 1.0 Strict
which is still not right!
How to fall down to the last two entries?
Maybe I should remove the XH50 bit if there is NO
xml declaration...
You have set the 'score' of these 2 new entries to 20
and 21, but the logic takes the 'lowest' score found
if (vers & W3C_Doctypes[i].vers &&
(W3C_DocTypes[i].score < score || !score))
and XHTML 1.0 Strict is the lowest first found...
Need a way to output -
Info: Document contents look like HTML5
which is what test-001.html is, and the W3C validates
it as HTML5...
2. Allowing <noscript> in <head>, and not discarding it!
Added these 3 lines to test-001.html
<noscript>
<meta http-equiv="refresh" content="0; url=/javascript-disabled/">
</noscript>
The problem here seemed to be that in the 'tags' Dict
tag_defs[] CM_HEAD is NOT in the TidyTag_NOSCRIPT 'model'...
At first I thought of adding this CM_HEAD bit to
the Dict table if found HTML5, but the table
is marked 'const' so can NOT alter it dynamically...
that seems a shame...
Then even adding that bit into the table, and
re-compiling there is still a later test in :-
if (TY_(nodeIsElement)(node)) {
...
} elsif if (nodeIsNOSCRIPT(node)) {
// report TAG_NOT_ALLOWED_IN
So at this time no success in getting a 'fix'
to retain the <noscript><...></noscript> in the
<head>...
In a way it seems HTML5 'breaks' lots of the previous
parsing logic of Tidy ;=((
Anyway, have not exactly given up ;=)) But out of time
tonight...
But having considerable difficulty keeping the current
behavior for 'lower' version documents, and preforming
'new' parsing of HTML5...
Maybe I do not understand the Tidy code as well as
I think I do ;=()
Any help, comments, ideas, pointers, etc much
appreciated...
Regards,
Geoff.
PS: Have done another push to geoffmcl/tidy-fork, this
time from Windows, to make sure that works, and -
(a) in the interest of KISS, have 'simplified' the
tidy.dsw - the tidydll.dsp remains, but is now
excluded from the dsw, and adjusted the outputs of
tidy.dsp and libtidy.dsp to bin and lib resp... and
(b) added some more folders, and files to .gitignore
to ignore some more Windows 'built' items...
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d