Permalink
Browse files

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

  • Loading branch information...
1 parent 5b9d25d commit bf1c2f67a91c8ecc349a41a01c7d13debcafda67 @sideshowbarker sideshowbarker committed Mar 15, 2012
Showing with 8 additions and 0 deletions.
  1. +1 −0 include/tidyenum.h
  2. +1 −0 src/config.c
  3. +3 −0 src/localize.c
  4. +3 −0 src/parser.c
View
@@ -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
@@ -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
@@ -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
@@ -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;

0 comments on commit bf1c2f6

Please sign in to comment.