htacg / tidy-html5

The granddaddy of HTML tools, with support for modern standards
http://www.html-tidy.org
2.71k stars 418 forks source link

Support custom elements #119

Closed Moult closed 7 years ago

Moult commented 10 years ago

Spec is here: http://www.w3.org/TR/custom-elements/

Currently, custom elements throw errors.

geoffmcl commented 7 years ago

I still get 12 diffs, in linux and windows...

11 of them are only one newline, and can be removed with -B... the remaining is 431716, unknown option: split...

I tested with a tidy built from the custom_tags branch... at da55a6e4... I remember seeing at some time a commit with these newlines added... as suggested, maybe it is not yet in custom_tags branch... am I doing something wrong here?

Wow, so much said about --show-info no, that I hesitate to go on... I forced that "Document content looks like HTML5" to always be output... now so long ago... for debug at the time... I will fix that.

Did not follow all your tangents ;=))

geoffmcl commented 7 years ago

Not that this is related to supporting custom_tags, but can not immediately find an issue for --show-tags, so just pushed a fix here... thanks...

There is no urgency on this, it can be merged to next, when ever this branch is merged... which I think will be shortly...

On that, if we can get a clean tidy-tests, custom_tags branch, then I think we should do this PR #514...

What do you think? In all testing so far it appears stable...

I have retested the inline and blocklevel and so far seen no problems here.. quibble why not inline, block, or maybe inlinelevel - no that's too much...

Any other minor things that may come up, can be dealt with directly in the development branch, maybe under their own issue... thanks...

geoffmcl commented 7 years ago

@balthisar ok, I am getting an extra newline added by Tidy 5.5.6I119.3, in the results of 11 cases... starting with 1053626...

Trying to track down where this is added...

Expected output -

For further advice on how to make your pages accessible
see http://www.w3.org/WAI/GL.
About HTML Tidy: https://github.com/htacg/tidy-html5

But getting a newline after WAI/GL., that should not be there... if someone beats me to it, that would be great... thanks...

geoffmcl commented 7 years ago

Presently testing this diff -

diff --git a/src/language_en.h b/src/language_en.h
index 2b23455..aac3a3c 100644
--- a/src/language_en.h
+++ b/src/language_en.h
@@ -227,13 +227,13 @@ static languageDefinition language_en = { whichPluralForm_en, {
         - The URL should not be translated unless you find a matching URL in your language. */
       TEXT_ACCESS_ADVICE1,          0,
         "For further advice on how to make your pages accessible\n"
-        "see http://www.w3.org/WAI/GL.\n"
+        "see http://www.w3.org/WAI/GL."
     },
     {/* This console output should be limited to 78 characters per line.
         - The URL should not be translated unless you find a matching URL in your language. */
       TEXT_ACCESS_ADVICE2,          0,
         "For further advice on how to make your pages accessible\n"
-        "see http://www.w3.org/WAI/GL and http://www.html-tidy.org/accessibility/.\n"
+        "see http://www.w3.org/WAI/GL and http://www.html-tidy.org/accessibility/."
     },
     {/* This console output should be limited to 78 characters per line. */
       TEXT_USING_LAYER,             0,
@@ -262,7 +262,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
     },
     {/* This console output should be limited to 78 characters per line. */
       TEXT_USING_BODY,              0,
-        "You are recommended to use CSS to specify page and link colors\n"
+        "You are recommended to use CSS to specify page and link colors"
     },
     {/* This console output should be limited to 78 characters per line.
         - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */

Just 3 newline char, \n removed... still in testing...

balthisar commented 7 years ago

I had thought I'd cleaned those all up! Yet sometimes I see them in Github's diff. I need to check my environment and see why they're not being applied...

balthisar commented 7 years ago

Note, I just made a very small, corrective push. It doesn't address the above issue.

geoffmcl commented 7 years ago

@balthisar also searched deeply for where they were added...

I can see where the \n got added - commit https://github.com/htacg/tidy-html5/commit/11178d775ba22ef52b4cdc881f61447c4b170fec - at least to TEXT_ACCESS_ADVICE1 and 2, and TEXT_USING_BODY text... and no subsequent commit removing them... they are extra...

Can I push the above diff change? To tidy custom_tags of course...

It clears most of the diffs... seems just 2 remain -

Although the split could also be fixed by removing it from that specific conf... Which do you prefer? I lean to leaving it there, but easy either way...

Getting close ... thanks...

balthisar commented 7 years ago

Can I push the above diff change? To tidy custom_tags of course...

By all means!

Update expected for both of those, and then it looks like we are good to go.

geoffmcl commented 7 years ago

Done... and will update expects in tests unless you beat me to it ;=))

A question of code: Two times I see (doc->lexer->doctype & VERS_HTML5) in the code...

It is my understanding that lexer->doctype will always only contain a single bit... you can not have a doctype that is this or that... the doctype is one!

In the second case, doctype had already been setup, uint declared = doc->lexer->doctype;... so if a new variable is created. and nothing wrong with that, would prefer to see Bool htmlIs5 = (declared == VERS_HTML5) ? yes : no;, or something like that...

But really quite minor...

I too think we are good to go... thanks...

balthisar commented 7 years ago

Awesome work.

I'm not sure I understand where the variable declared comes from. In any case, the VERS_HTML5 is a compound type, made up of both HTML5 and XHTML5 (which I've never seen in the field).

But if we're good to go for now, then awesome! Let's roll it in.

geoffmcl commented 7 years ago

@balthisar not me, but to you, and others, thanks for this great step forward...

Forget my drivel about the compound type VERS_HTML5... must have been asleep, or something...

It should be your honor to push the green button for #514 ... and bump the next version... and close this... I will move #10 forward... create next, etc... making live testing easier...

So is is born, along with custom tags, or ACTs, blended with existing the new-xxxxxx-tags options, combined with what we hope is an easier message system, and various other goodies along the way...

On y va! (let;s go) ;=))

balthisar commented 7 years ago

On y va!

Well, I'll do this thing, then!

fyiman commented 7 years ago

Is --custom-tags option supported in any release versions of Tidy-html? If so, which versions?

I am currently using HTML Tidy version 5.5.6 (on Windows), and the --custom-tags option is not supported in that version, I get an error:

C:\Temp\tidy\test>type "Somefile" | tidy --custom-tags yes -i -o outfile.htm
Config: unknown option: custom-tags
Error: Can't open "yes"
geoffmcl commented 7 years ago

@fyiman well that option was added by commit 5606f32f1...

And I can see a little later in the $ git log -

commit 1dbacc9c43d42679728310d58172b4896b855bf5
Author: Jim Derry <balthisar@gmail.com>
Date:   Sun Mar 19 08:09:43 2017 -0400

    Bumped to 5.5.7 to support custom tags.

so I guess you need to update from your Tidy version 5.5.6 to use this option...

At present we have no way of publishing later versions officially, but I guess we should try to think of something... for in-between releases...

I do from time to time make test versions available, like http://geoffair.org/tmp/tidy-5.5.31.I567-3-w64-vc14-md.zip... maybe I could put later version there, or somewhere else on my site, like I did years ago... will think about this, and seek feedback and ideas...

HTH...

fyiman commented 7 years ago

@geoffmcl Thanks for looking into that. Is the version you linked (http://geoffair.org/tmp/tidy-5.5.31.I567-3-w64-vc14-md.zip) something I should try (I have AMD x64 CPU on Windows 7 x64) ?

Is there a new Official release on the horizon?

geoffmcl commented 7 years ago

@fyiman well it would be interesting to see if it runs in Windows 7 x64... You may need to install the MSVC14 2015 redistributables, if you do not have MSVC14 installed... that version 5.5.31 is certainly a release candidate, so is stable...

Is there a new Official release on the horizon?

Well I had rather randomly set the next release for mid August, but it turns out I will be away from then until about mid September, so I will get around to resetting the next target release date around mid September...

It certainly does seem about time for a new official 5.6 release... a lot of good things have been added during this 5.5 dev cycle...

But on the other hand we do have some 30 plus issues outstanding, and a few pull requests... I certainly hope some of those can be closed first... but we will see...

And still pondering on where to add some intermediate versions for testing...

ishandutta2007 commented 5 years ago

is this feature completed ? I installed from homebrew doesn't seem to be there ?