Merge branch 'issue_575' into next

This commit is contained in:
Jim Derry 2017-10-02 13:19:40 -04:00
commit 6619062aaa
7 changed files with 87 additions and 51 deletions

View file

@ -122,27 +122,28 @@ extern "C" {
** than the short report.
*/
#define FOREACH_FOOTNOTE_MSG(FN) \
/** Explanatory text. */ FN(TEXT_ACCESS_ADVICE1) \
/** Explanatory text. */ FN(TEXT_ACCESS_ADVICE2) \
/** Explanatory text. */ FN(TEXT_BAD_FORM) \
/** Explanatory text. */ FN(TEXT_BAD_MAIN) \
/** Explanatory text. */ FN(TEXT_HTML_T_ALGORITHM) \
/** Explanatory text. */ FN(TEXT_INVALID_URI) \
/** Explanatory text. */ FN(TEXT_INVALID_UTF16) \
/** Explanatory text. */ FN(TEXT_INVALID_UTF8) \
/** Explanatory text. */ FN(TEXT_M_IMAGE_ALT) \
/** Explanatory text. */ FN(TEXT_M_IMAGE_MAP) \
/** Explanatory text. */ FN(TEXT_M_LINK_ALT) \
/** Explanatory text. */ FN(TEXT_M_SUMMARY) \
/** Explanatory text. */ FN(TEXT_SGML_CHARS) \
/** Explanatory text. */ FN(TEXT_USING_BODY) \
/** Explanatory text. */ FN(TEXT_USING_FONT) \
/** Explanatory text. */ FN(TEXT_USING_FRAMES) \
/** Explanatory text. */ FN(TEXT_USING_LAYER) \
/** Explanatory text. */ FN(TEXT_USING_NOBR) \
/** Explanatory text. */ FN(TEXT_USING_SPACER) \
/** Explanatory text. */ FN(TEXT_VENDOR_CHARS) \
/** Explanatory text. */ FN(TEXT_WINDOWS_CHARS)
FN(FOOTNOTE_TRIM_EMPTY_ELEMENT) \
FN(TEXT_ACCESS_ADVICE1) \
FN(TEXT_ACCESS_ADVICE2) \
FN(TEXT_BAD_FORM) \
FN(TEXT_BAD_MAIN) \
FN(TEXT_HTML_T_ALGORITHM) \
FN(TEXT_INVALID_URI) \
FN(TEXT_INVALID_UTF16) \
FN(TEXT_INVALID_UTF8) \
FN(TEXT_M_IMAGE_ALT) \
FN(TEXT_M_IMAGE_MAP) \
FN(TEXT_M_LINK_ALT) \
FN(TEXT_M_SUMMARY) \
FN(TEXT_SGML_CHARS) \
FN(TEXT_USING_BODY) \
FN(TEXT_USING_FONT) \
FN(TEXT_USING_FRAMES) \
FN(TEXT_USING_LAYER) \
FN(TEXT_USING_NOBR) \
FN(TEXT_USING_SPACER) \
FN(TEXT_VENDOR_CHARS) \
FN(TEXT_WINDOWS_CHARS)
/** These messages are used to generate additional dialogue style output from

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-09-29 10:42:01\n"
"POT-Creation-Date: 2017-10-02 13:19:15\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -1980,6 +1980,15 @@ msgid ""
"include an alternative layout inside a NOFRAMES element.\n"
msgstr ""
#. This console output should be limited to 78 characters per line.
msgctxt "FOOTNOTE_TRIM_EMPTY_ELEMENT"
msgid ""
"One or more empty elements were present in the source document but\n"
"dropped on output. If these elements are necessary or you don't want\n"
"this behavior, then consider setting the option \"drop-empty-elements\"\n"
"to no.\n"
msgstr ""
#. 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.
msgctxt "TEXT_ACCESS_ADVICE1"

View file

@ -1761,6 +1761,13 @@ static languageDefinition language_en = { whichPluralForm_en, {
"doesn't support frames. A frames-based page should always\n"
"include an alternative layout inside a NOFRAMES element.\n"
},
{/* This console output should be limited to 78 characters per line. */
FOOTNOTE_TRIM_EMPTY_ELEMENT, 0,
"One or more empty elements were present in the source document but\n"
"dropped on output. If these elements are necessary or you don't want\n"
"this behavior, then consider setting the option \"drop-empty-elements\"\n"
"to no.\n"
},
{/* 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_ADVICE1, 0,

View file

@ -1010,6 +1010,7 @@ static struct _dialogueDispatchTable {
{ STRING_NO_ERRORS, TidyDialogueSummary }, /* ReportNumWarnings() */
{ STRING_NOT_ALL_SHOWN, TidyDialogueSummary }, /* ReportNumWarnings() */
{ FOOTNOTE_TRIM_EMPTY_ELEMENT, TidyDialogueFootnote },
{ TEXT_ACCESS_ADVICE1, TidyDialogueFootnote }, /* errorSummary() */
{ TEXT_ACCESS_ADVICE2, TidyDialogueFootnote },
{ TEXT_BAD_FORM, TidyDialogueFootnote },
@ -1030,6 +1031,8 @@ static struct _dialogueDispatchTable {
{ TEXT_USING_NOBR, TidyDialogueFootnote },
{ TEXT_USING_SPACER, TidyDialogueFootnote },
{ TEXT_VENDOR_CHARS, TidyDialogueFootnote },
{ 0, 0 }
};
@ -1054,6 +1057,7 @@ TidyMessageImpl *formatDialogue( TidyDocImpl* doc, uint code, TidyReportLevel le
doc->warnings, tidyLocalizedStringN( STRING_ERROR_COUNT_WARNING, doc->warnings ),
doc->errors, tidyLocalizedStringN( STRING_ERROR_COUNT_ERROR, doc->errors ) );
case FOOTNOTE_TRIM_EMPTY_ELEMENT:
case STRING_HELLO_ACCESS:
case STRING_NEEDS_INTERVENTION:
case STRING_NO_ERRORS:
@ -1222,6 +1226,13 @@ void TY_(ErrorSummary)( TidyDocImpl* doc )
if (doc->badLayout & USING_BODY)
TY_(Dialogue)( doc, TEXT_USING_BODY );
}
if (doc->footnotes)
{
if (doc->footnotes & FN_TRIM_EMPTY_ELEMENT)
TY_(Dialogue)( doc, FOOTNOTE_TRIM_EMPTY_ELEMENT );
}
}

View file

@ -260,6 +260,10 @@ uint TY_(getNextErrorCode)( TidyIterator* iter );
#define BC_INVALID_URI 32
#define BC_INVALID_NCR 64
/* other footnote bit field (temporary until formalized) */
#define FN_TRIM_EMPTY_ELEMENT 1
/* Lexer and I/O Macros */
#define REPLACED_CHAR 0

View file

@ -337,7 +337,10 @@ Node *TY_(TrimEmptyElement)( TidyDocImpl* doc, Node *element )
if ( CanPrune(doc, element) )
{
if (element->type != TextNode)
{
doc->footnotes |= FN_TRIM_EMPTY_ELEMENT;
TY_(Report)(doc, element, NULL, TRIM_EMPTY_ELEMENT);
}
return TY_(DiscardElement)(doc, element);
}

View file

@ -76,6 +76,7 @@ struct _TidyDocImpl
uint badLayout; /* for bad style errors */
uint badChars; /* for bad char encodings */
uint badForm; /* bit field, for badly placed form tags, or other format errors */
uint footnotes; /* bit field, for other footnotes, until formalized */
Bool HTML5Mode; /* current mode is html5 */
Bool xmlDetected; /* true if XML was used/detected */