From d1e0b22be7d8a2a4c9b5a8da9a26ed45d07a83ba Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 4 Apr 2017 14:42:47 -0400 Subject: [PATCH 1/2] Removed TidyDropFontTags. Note that POs and POT were _not_ updated. --- include/tidyenum.h | 1 - src/clean.c | 35 ----------------------------------- src/config.c | 1 - src/language_en.h | 24 ------------------------ src/tidylib.c | 3 +-- 5 files changed, 1 insertion(+), 63 deletions(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index dd148bd..e86e307 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -553,7 +553,6 @@ typedef enum #endif TidyDropEmptyElems, /**< Discard empty elements */ TidyDropEmptyParas, /**< Discard empty p elements */ - TidyDropFontTags, /**< Discard presentation tags */ TidyDropPropAttrs, /**< Discard proprietary attributes */ TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */ TidyEmacs, /**< If true, format error output for GNU Emacs */ diff --git a/src/clean.c b/src/clean.c index b92a85d..779ddec 100644 --- a/src/clean.c +++ b/src/clean.c @@ -1007,35 +1007,6 @@ static Bool Center2Div( TidyDocImpl* doc, Node *node, Node **pnode) { if ( nodeIsCENTER(node) ) { -#if 0 /* 00000000 what is this doing inside an nodeIsCENTER(node)??? 0000000 */ - if ( cfgBool(doc, TidyDropFontTags) ) - { - if (node->content) - { - Node *last = node->last; - DiscardContainer( doc, node, pnode ); - - node = TY_(InferredTag)(doc, TidyTag_BR); - TY_(InsertNodeAfterElement)(last, node); - } - else - { - Node *prev = node->prev, *next = node->next, - *parent = node->parent; - DiscardContainer( doc, node, pnode ); - - node = TY_(InferredTag)(doc, TidyTag_BR); - if (next) - TY_(InsertNodeBeforeElement)(next, node); - else if (prev) - TY_(InsertNodeAfterElement)(prev, node); - else - TY_(InsertNodeAtStart)(parent, node); - } - - return yes; - } -#endif /* 00000000 what is this doing inside an nodeIsCENTER(node)??? 0000000 */ RenameElem( doc, node, TidyTag_DIV ); TY_(AddStyleProperty)( doc, node, "text-align: center" ); return yes; @@ -1394,12 +1365,6 @@ static Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode ) if ( nodeIsFONT(node) ) { - if ( cfgBool(doc, TidyDropFontTags) ) - { - DiscardContainer( doc, node, pnode ); - return yes; - } - /* if node is the only child of parent element then leave alone Do so only if BlockStyle may be succesful. */ if ( node->parent->content == node && node->next == NULL && diff --git a/src/config.c b/src/config.c index 221b475..e36b27c 100644 --- a/src/config.c +++ b/src/config.c @@ -249,7 +249,6 @@ static const TidyOptionImpl option_defs[] = #endif { TidyDropEmptyElems, MU, "drop-empty-elements", BL, yes, ParseBool, boolPicks }, { TidyDropEmptyParas, MU, "drop-empty-paras", BL, yes, ParseBool, boolPicks }, - { TidyDropFontTags, MU, "drop-font-tags", BL, no, ParseBool, boolPicks }, { TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParseBool, boolPicks }, { TidyDuplicateAttrs, MU, "repeated-attributes", IN, TidyKeepLast, ParseRepeatAttr, repeatAttrPicks }, { TidyEmacs, MS, "gnu-emacs", BL, no, ParseBool, boolPicks }, diff --git a/src/language_en.h b/src/language_en.h index 1af5fa8..70d76c0 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -330,30 +330,6 @@ static languageDefinition language_en = { whichPluralForm_en, { TidyDropEmptyParas, 0, "This option specifies if Tidy should discard empty paragraphs. " }, - {/* Important notes for translators: - - Use only , , , , and -
. - - Entities, tags, attributes, etc., should be enclosed in . - - Option values should be enclosed in . - - It's very important that
be self-closing! - - The strings "Tidy" and "HTML Tidy" are the program name and must not - be translated. */ - TidyDropFontTags, 0, - "Deprecated; do not use. This option is destructive to " - "<font> tags, and it will be removed from future " - "versions of Tidy. Use the clean option instead. " - "
" - "If you do set this option despite the warning it will perform " - "as clean except styles will be inline instead of put into " - "a CSS class. <font> tags will be dropped completely " - "and their styles will not be preserved. " - "
" - "If both clean and this option are enabled, " - "<font> tags will still be dropped completely, and " - "other styles will be preserved in a CSS class instead of inline. " - "
" - "See clean for more information. " - }, {/* Important notes for translators: - Use only , , , , and
. diff --git a/src/tidylib.c b/src/tidylib.c index 726df24..b429314 100755 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1973,7 +1973,6 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc ) Bool logical = cfgBool( doc, TidyLogicalEmphasis ); Bool clean = cfgBool( doc, TidyMakeClean ); Bool gdoc = cfgBool( doc, TidyGDocClean ); - Bool dropFont = cfgBool( doc, TidyDropFontTags ); Bool htmlOut = cfgBool( doc, TidyHtmlOut ); Bool xmlOut = cfgBool( doc, TidyXmlOut ); Bool xhtmlOut = cfgBool( doc, TidyXhtmlOut ); @@ -2014,7 +2013,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc ) } /* replaces presentational markup by style rules */ - if ( clean || dropFont ) + if ( clean ) TY_(CleanDocument)( doc ); /* clean up html exported by Google Docs */ From 49b833f63bd1cc1022b3775aba9b259495105e25 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Wed, 3 May 2017 18:16:03 -0400 Subject: [PATCH 2/2] WIP --- console/tidy.c | 6 ------ include/tidyenum.h | 1 - src/config.c | 3 +-- src/language_en.h | 11 ----------- src/pprint.c | 8 +++----- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/console/tidy.c b/console/tidy.c index 9ee258f..4a9fe0a 100644 --- a/console/tidy.c +++ b/console/tidy.c @@ -2261,12 +2261,6 @@ int main( int argc, char** argv ) tidyOptResetToDefault( tdoc, TidyIndentSpaces ); break; - /* Usurp -o for output file. Anyone hiding end tags? - case 'o': - tidyOptSetBool( tdoc, TidyHideEndTags, yes ); - break; - */ - case 'u': tidyOptSetBool( tdoc, TidyUpperCaseTags, yes ); break; diff --git a/include/tidyenum.h b/include/tidyenum.h index e86e307..567f1ba 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -571,7 +571,6 @@ typedef enum TidyForceOutput, /**< Output document even if errors were found */ TidyGDocClean, /**< Clean up HTML exported from Google Docs */ TidyHideComments, /**< Hides all (real) comments in output */ - TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */ TidyHtmlOut, /**< Output plain HTML, even for XHTML input.*/ TidyInCharEncoding, /**< Input character encoding (if different) */ TidyIndentAttributes, /**< Newline+indent before each attribute */ diff --git a/src/config.c b/src/config.c index e36b27c..1ad46d7 100644 --- a/src/config.c +++ b/src/config.c @@ -267,7 +267,6 @@ static const TidyOptionImpl option_defs[] = { TidyForceOutput, MS, "force-output", BL, no, ParseBool, boolPicks }, { TidyGDocClean, MU, "gdoc", BL, no, ParseBool, boolPicks }, { TidyHideComments, MU, "hide-comments", BL, no, ParseBool, boolPicks }, - { TidyHideEndTags, MU, "hide-endtags", BL, no, ParseBool, boolPicks }, { TidyHtmlOut, MU, "output-html", BL, no, ParseBool, boolPicks }, { TidyInCharEncoding, CE, "input-encoding", IN, UTF8, ParseCharEnc, charEncPicks }, { TidyIndentAttributes, PP, "indent-attributes", BL, no, ParseBool, boolPicks }, @@ -1095,7 +1094,7 @@ void AdjustConfig( TidyDocImpl* doc ) TY_(SetOptionInt)( doc, TidyOutputBOM, yes ); #endif TY_(SetOptionBool)( doc, TidyQuoteAmpersand, yes ); - TY_(SetOptionBool)( doc, TidyHideEndTags, no ); + TY_(SetOptionBool)( doc, TidyOmitOptionalTags, no ); } } diff --git a/src/language_en.h b/src/language_en.h index 70d76c0..e73f873 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -533,17 +533,6 @@ static languageDefinition language_en = { whichPluralForm_en, { TidyHideComments, 0, "This option specifies if Tidy should print out comments. " }, - {/* Important notes for translators: - - Use only , , , , and -
. - - Entities, tags, attributes, etc., should be enclosed in . - - Option values should be enclosed in . - - It's very important that
be self-closing! - - The strings "Tidy" and "HTML Tidy" are the program name and must not - be translated. */ - TidyHideEndTags, 0, - "This option is an alias for omit-optional-tags. " - }, {/* Important notes for translators: - Use only , , , , and
. diff --git a/src/pprint.c b/src/pprint.c index fcac5fd..a6d2186 100644 --- a/src/pprint.c +++ b/src/pprint.c @@ -789,9 +789,8 @@ static void PCondFlushLineSmart( TidyDocImpl* doc, uint indent ) /*\ * Issue #390 - Must still deal with fixing indent! - * If TidyHideEndTags or TidyOmitOptionalTags, then - * in certain circumstance no PrintEndTag will be done, - * so linelen will be 0... + * If TidyOmitOptionalTags, then in cerain circumstances no PrintEndTag + * will be done, so linelen will be 0... \*/ if (pprint->indent[ 0 ].spaces != (int)indent) { @@ -2340,8 +2339,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node ) { Bool indcont = ( cfgAutoBool(doc, TidyIndentContent) != TidyNoState ); Bool indsmart = ( cfgAutoBool(doc, TidyIndentContent) == TidyAutoState ); - Bool hideend = cfgBool( doc, TidyHideEndTags ) || - cfgBool( doc, TidyOmitOptionalTags ); + Bool hideend = cfgBool( doc, TidyOmitOptionalTags ); Bool classic = TidyClassicVS; /* #228 - cfgBool( doc, TidyVertSpace ); */ uint contentIndent = indent;