get list of tags WITHOUT HT50 version

This commit is contained in:
Geoff McLane 2014-08-08 19:20:28 +02:00
parent 277db6e145
commit 6c37493c75
2 changed files with 87 additions and 3 deletions

View file

@ -10,7 +10,9 @@
#include "tidy-int.h"
#include "message.h"
#include "tmbstr.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
#include "sprtf.h"
#endif
/* Attribute checking methods */
static CheckAttribs CheckIMG;
static CheckAttribs CheckLINK;
@ -476,6 +478,57 @@ static void declare( TidyDocImpl* doc, TidyTagImpl* tags,
}
}
#if !defined(NDEBUG) && defined(_MSC_VER)
/* ====================================================================
MSVC DEBUG ONLY
*/
void ListElementsPerVersion( uint vers, Bool has )
{
uint val, cnt, total, wrap = 10;
const Dict *np = tag_defs + 1;
const Dict *end = tag_defs + N_TIDY_TAGS;
cnt = 0;
total = 0;
for ( ; np < end; np++) {
val = (np->versions & vers);
if (has) {
if (val) {
SPRTF("%s ",np->name);
cnt++;
total++;
}
} else {
if (!val) {
SPRTF("%s ",np->name);
cnt++;
total++;
}
}
if (cnt == wrap) {
SPRTF("\n");
cnt = 0;
}
}
if (cnt)
SPRTF("\n");
SPRTF("Listed total %u tags that %s version %u\n", total,
(has ? "have" : "do not have"),
vers );
}
void show_not_html5(void)
{
SPRTF("List tags that do not have version HTML5 (HT50|XH50)\n"),
ListElementsPerVersion( VERS_HTML5, no );
}
void show_have_html5(void)
{
ListElementsPerVersion( VERS_HTML5, yes );
}
#endif
/* public interface for finding tag by name */
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
{

View file

@ -1228,6 +1228,32 @@ int tidyDocRunDiagnostics( TidyDocImpl* doc )
return tidyDocStatus( doc );
}
/* ######################################################################################
HTML5 STUFF
*/
#if !defined(NDEBUG) && defined(_MSC_VER)
extern void show_not_html5(void);
/* -----------------------------
List tags that do not have version HTML5 (HT50|XH50)
acronym applet basefont big center dir font frame frameset isindex
listing noframes plaintext rb rbc rtc strike tt xmp nextid
align bgsound blink comment ilayer layer marquee multicol nobr noembed
nolayer nosave server servlet spacer
Listed total 35 tags that do not have version 393216
------------------------------ */
static void list_not_html5(void)
{
static Bool done_list = no;
if (done_list == no) {
done_list = yes;
show_not_html5();
}
}
#endif
/* What about <blink>, <s> stike-through, <u> underline */
static struct _html5Info
{
@ -1293,7 +1319,9 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
Bool clean = cfgBool( doc, TidyMakeClean );
Node* body = TY_(FindBody)( doc );
Bool warn = yes; /* should this be a warning, error, or report??? */
#if !defined(NDEBUG) && defined(_MSC_VER)
// list_not_html5();
#endif
while (node)
{
if ( nodeHasAlignAttr( node ) ) {
@ -1434,7 +1462,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
if (TY_(nodeIsElement)(node)) {
if (node->tag) {
if ((!(node->tag->versions & VERS_HTML5))||(inRemovedInfo(node->tag->id))) {
/* issue warning */
/* issue warning for elements like 'markquee' */
TY_(ReportWarning)(doc, node, node, REMOVED_HTML5);
}
}
@ -1446,6 +1474,9 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
node = node->next;
}
}
/* END HTML5 STUFF
######################################################################################
*/
int tidyDocCleanAndRepair( TidyDocImpl* doc )
{