Added drop-empty-elements options. Fixes #19.
This commit is contained in:
parent
5b9d25dcf9
commit
bf1c2f67a9
|
@ -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? */
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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. "
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue