I think the messages are where I want them to be. Will generate test cases

for comparison. Also regen'd all pots and language headers.
This commit is contained in:
Jim Derry 2017-03-15 17:36:05 -04:00
parent 61692401ce
commit 0c5550b06f
17 changed files with 72 additions and 31 deletions

View file

@ -908,7 +908,6 @@ typedef enum
FN(PROPRIETARY_ELEMENT) \
FN(REPLACING_ELEMENT) \
FN(CUSTOM_TAG_DETECTED) \
FN(CUSTOM_TAG_DETECTED_SETTING) \
FN(REPLACING_UNEX_ELEMENT) \
FN(SPACE_PRECEDING_XMLDECL) \
FN(SUSPECTED_MISSING_QUOTE) \
@ -921,6 +920,7 @@ typedef enum
FN(UNEXPECTED_ENDTAG_IN) \
FN(UNEXPECTED_ENDTAG) \
FN(UNKNOWN_ELEMENT) \
FN(UNKNOWN_ELEMENT_LOOKS_CUSTOM) \
FN(USING_BR_INPLACE_OF)
/* error codes used for attribute messages */

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-03-11 18:31:52\n"
"PO-Revision-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -873,6 +873,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr ""
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-03-11 18:31:52\n"
"PO-Revision-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -869,6 +869,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr ""
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-03-11 18:31:52\n"
"PO-Revision-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -869,6 +869,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr ""
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-03-11 18:31:52\n"
"PO-Revision-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -1006,6 +1006,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr "%s n'est pas reconnue !"
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-03-11 18:31:52\n"
"PO-Revision-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -863,6 +863,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr ""
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-03-11 18:31:52\n"
"POT-Creation-Date: 2017-03-15 17:35:16\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -865,6 +865,11 @@ msgctxt "UNKNOWN_ELEMENT"
msgid "%s is not recognized!"
msgstr ""
#, c-format
msgctxt "UNKNOWN_ELEMENT_LOOKS_CUSTOM"
msgid "%s is not recognized! Did you mean to enable the custom-tags option?"
msgstr ""
#, c-format
msgctxt "PREVIOUS_LOCATION"
msgid "<%s> previously mentioned"

View file

@ -386,7 +386,6 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ TRIM_EMPTY_ELEMENT, 0, "trimming empty %s" }, /* Notice */
{ REPLACING_ELEMENT, 0, "replacing %s with %s" }, /* Notice */
{ CUSTOM_TAG_DETECTED, 0, "detected autonomous custom tag %s; will treat as %s" }, /* Notice */
{ CUSTOM_TAG_DETECTED_SETTING, 0, "%s appears to be an autonomous custom tag; did you mean to set the custom-tags option?" }, /* Notice */
{ TidyCustomBlocklevel, 0, "block level" },
{ TidyCustomEmpty, 0, "empty" },
{ TidyCustomInline, 0, "inline" },
@ -437,6 +436,8 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ SUSPECTED_MISSING_QUOTE, 0, "missing quote mark for attribute value" }, /* Error? (not really sometimes) */
{ DUPLICATE_FRAMESET, 0, "repeated FRAMESET element" }, /* Error */
{ UNKNOWN_ELEMENT, 0, "%s is not recognized!" }, /* Error */
{ UNKNOWN_ELEMENT_LOOKS_CUSTOM, 0, "%s is not recognized! Did you mean to enable the custom-tags option?" }, /* Error */
/* Info */
{ PREVIOUS_LOCATION, 0, "<%s> previously mentioned" }, /* Info */

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-03-11 18:31:52
* PO_REVISION_DATE=2017-03-15 17:35:16
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-03-11 18:31:52
* PO_REVISION_DATE=2017-03-15 17:35:16
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-03-11 18:31:52
* PO_REVISION_DATE=2017-03-15 17:35:16
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-03-11 18:31:52
* PO_REVISION_DATE=2017-03-15 17:35:16
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-03-11 18:31:52
* PO_REVISION_DATE=2017-03-15 17:35:16
*/
#ifdef _MSC_VER

View file

@ -3000,7 +3000,17 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
if (lexer->token->tag == NULL)
{
if (mode != OtherNamespace) /* [i_a]2 only issue warning if NOT 'OtherNamespace', and tag null */
TY_(ReportFatal)( doc, NULL, lexer->token, UNKNOWN_ELEMENT );
{
/* Special case for HTML5 unknown tags: if it looks
like an autonomous custom tag, then emit a variation
of the standard message. We don't want to do this
for older HTML, because it's not truly supported
by the standard, although Tidy will allow it. */
if ( (doc->lexer->doctype & VERS_HTML5) > 0 && TY_(elementIsAutonomousCustomFormat)( lexer->token->element ) )
TY_(ReportFatal)( doc, NULL, lexer->token, UNKNOWN_ELEMENT_LOOKS_CUSTOM );
else
TY_(ReportFatal)( doc, NULL, lexer->token, UNKNOWN_ELEMENT );
}
}
else if ( !cfgBool(doc, TidyXmlTags) )
{

View file

@ -232,11 +232,6 @@ void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code)
tagtype = tidyLocalizedString( cfg( doc, TidyUseCustomTags ) );
message = TY_(tidyMessageCreateWithNode)(doc, element, code, TidyInfo, elemdesc, tagtype );
break;
case CUSTOM_TAG_DETECTED_SETTING:
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyInfo, nodedesc );
break;
}
messageOut( message );
@ -418,6 +413,7 @@ void TY_(ReportFatal)( TidyDocImpl* doc, Node *element, Node *node, uint code)
break;
case UNKNOWN_ELEMENT:
case UNKNOWN_ELEMENT_LOOKS_CUSTOM:
TagToString(node, nodedesc, sizeof(nodedesc));
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyError, nodedesc );
break;

View file

@ -586,13 +586,6 @@ Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
return yes;
}
else if ( TY_(nodeIsAutonomousCustomFormat)( node ) && htmlIs5 )
{
/* It looks like a custom tag, we're in HTML5, but custom-tags is
off, so warn the user. TODO: handle in the lexer so we don't
repeat this over and over again.*/
TY_(ReportNotice)(doc, node, node, CUSTOM_TAG_DETECTED_SETTING);
}
return no;
}
@ -1056,14 +1049,14 @@ Bool nodeMatchCM( Node* node, uint contentModel )
#endif
Bool TY_(nodeIsAutonomousCustomFormat)( Node* node )
Bool TY_(elementIsAutonomousCustomFormat)( ctmbstr element )
{
if ( node->element )
if ( element )
{
const char *ptr = strchr(node->element, '-');
const char *ptr = strchr(element, '-');
/* Tag must contain hyphen not in first character. */
if ( ptr && (ptr - node->element > 0) )
if ( ptr && (ptr - element > 0) )
{
return yes;
}
@ -1072,6 +1065,14 @@ Bool TY_(nodeIsAutonomousCustomFormat)( Node* node )
return no;
}
Bool TY_(nodeIsAutonomousCustomFormat)( Node* node )
{
if ( node->element )
return TY_(elementIsAutonomousCustomFormat)( node->element );
return no;
}
Bool TY_(nodeIsAutonomousCustomTag)( TidyDocImpl* doc, Node* node )
{
return TY_(nodeIsAutonomousCustomFormat)( node )

View file

@ -134,6 +134,9 @@ Bool nodeMatchCM( Node* node, uint contentModel );
#endif
/* True if the element looks like it's an autonomous custom element tag. */
Bool TY_(elementIsAutonomousCustomFormat)( ctmbstr element );
/* True if the node looks like it's an autonomous custom element tag. */
Bool TY_(nodeIsAutonomousCustomFormat)( Node* node );