Added drop-empty-elements options. Fixes #19.

This commit is contained in:
Michael[tm] Smith 2012-03-15 10:58:10 +09:00
parent 5b9d25dcf9
commit bf1c2f67a9
4 changed files with 8 additions and 0 deletions

View file

@ -126,6 +126,7 @@ typedef enum
TidyLogicalEmphasis, /**< Replace i by em and b by strong */
TidyDropPropAttrs, /**< Discard proprietary attributes */
TidyDropFontTags, /**< Discard presentation tags */
TidyDropEmptyElems, /**< Discard empty elements */
TidyDropEmptyParas, /**< Discard empty p elements */
TidyFixComments, /**< Fix comments with adjacent hyphens */
TidyBreakBeforeBR, /**< Output newline before <br> or not? */

View file

@ -251,6 +251,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyLogicalEmphasis, MU, "logical-emphasis", BL, no, ParseBool, boolPicks },
{ TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParseBool, boolPicks },
{ TidyDropFontTags, MU, "drop-font-tags", BL, no, ParseBool, boolPicks },
{ TidyDropEmptyElems, MU, "drop-empty-elements", BL, yes, ParseBool, boolPicks },
{ TidyDropEmptyParas, MU, "drop-empty-paras", BL, yes, ParseBool, boolPicks },
{ TidyFixComments, MU, "fix-bad-comments", BL, yes, ParseBool, boolPicks },
{ TidyBreakBeforeBR, PP, "break-before-br", BL, no, ParseBool, boolPicks },

View file

@ -425,6 +425,9 @@ static const TidyOptionDoc option_docs[] =
"<code>--numeric-entities yes</code>. This option does not offer a "
"validation of the document conformance. "
},
{TidyDropEmptyElems,
"This option specifies if Tidy should discard empty elements. "
},
{TidyDropEmptyParas,
"This option specifies if Tidy should discard empty paragraphs. "
},

View file

@ -240,6 +240,9 @@ void TY_(InsertNodeAfterElement)(Node *element, Node *node)
static Bool CanPrune( TidyDocImpl* doc, Node *element )
{
if ( !cfgBool(doc, TidyDropEmptyElems) )
return no;
if ( TY_(nodeIsText)(element) )
return yes;