Permalink
Browse files

Added omit-optional-tags option. Fixes #22.

Thanks towolf.
  • Loading branch information...
1 parent f5c2739 commit 2cd21a66937b89638e5965c141e1cfe53bfdda81 @sideshowbarker sideshowbarker committed Mar 24, 2012
Showing with 44 additions and 11 deletions.
  1. +3 −3 console/tidy.c
  2. +2 −1 include/tidyenum.h
  3. +26 −2 quickref.html
  4. +1 −0 src/config.c
  5. +9 −3 src/localize.c
  6. +2 −1 src/pprint.c
  7. +1 −1 src/version.h
View
@@ -191,8 +191,8 @@ static const CmdOptDesc cmdopt_defs[] = {
"suppress nonessential output",
"quiet: yes", CmdOptProcDir, "-q" },
{ "-omit",
- "omit optional end tags",
- "hide-endtags: yes", CmdOptProcDir },
+ "omit optional start tags and end tags",
+ "omit-optional-tags: yes", CmdOptProcDir },
{ "-xml",
"specify the input is well formed XML",
"input-xml: yes", CmdOptProcDir },
@@ -1002,7 +1002,7 @@ int main( int argc, char** argv )
tidyOptResetToDefault( tdoc, TidyIndentSpaces );
}
else if ( strcasecmp(arg, "omit") == 0 )
- tidyOptSetBool( tdoc, TidyHideEndTags, yes );
+ tidyOptSetBool( tdoc, TidyOmitOptionalTags, yes );
else if ( strcasecmp(arg, "upper") == 0 )
tidyOptSetBool( tdoc, TidyUpperCaseTags, yes );
View
@@ -113,7 +113,8 @@ typedef enum
TidyIndentContent, /**< Indent content of appropriate tags */
/**< "auto" does text/block level content indentation */
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
- TidyHideEndTags, /**< Suppress optional end tags */
+ TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */
+ TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */
TidyXmlTags, /**< Treat input as XML */
TidyXmlOut, /**< Create output as XML */
TidyXhtmlOut, /**< Output extensible HTML */
View
@@ -8,7 +8,7 @@
<body>
<h1 id="top">Quick Reference</h1>
<h2>HTML Tidy Configuration Options</h2>
- <p>Version: <a href="https://github.com/w3c/tidy-html5/tree/ddb5702">https://github.com/w3c/tidy-html5/tree/ddb5702</a></p>
+ <p>Version: <a href="https://github.com/w3c/tidy-html5/tree/4ff3234">https://github.com/w3c/tidy-html5/tree/4ff3234</a></p>
<p>
<a class="h3" href="#MarkupHeader">HTML, XHTML, XML</a>
<br />
@@ -324,6 +324,13 @@ <h1 id="top">Quick Reference</h1>
</tr>
<tr>
<td>
+ <a href="#omit-optional-tags">omit-optional-tags</a>
+ </td>
+ <td>Boolean</td>
+ <td>no</td>
+ </tr>
+ <tr>
+ <td>
<a href="#output-html">output-html</a>
</td>
<td>Boolean</td>
@@ -1149,7 +1156,7 @@ <h1 id="top">Quick Reference</h1>
<td align="right" valign="top"></td>
</tr>
<tr>
- <td colspan="2">This option specifies if Tidy should omit optional end-tags when generating the pretty printed markup. This option is ignored if you are outputting to XML. </td>
+ <td colspan="2">This option is an alias for the omit-optional-tags option. </td>
</tr>
<tr>
<td>&#160;</td>
@@ -1471,6 +1478,23 @@ <h1 id="top">Quick Reference</h1>
<td>&#160;</td>
</tr>
<tr>
+ <td class="tabletitle" valign="top" id="omit-optional-tags">omit-optional-tags</td>
+ <td class="tabletitlelink" valign="top" align="right">
+ <a href="#top">Top</a>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">Type: <strong>Boolean</strong><br />
+ Default: <strong>no</strong><br />Example: <strong>y/n, yes/no, t/f, true/false, 1/0</strong></td>
+ <td align="right" valign="top"></td>
+ </tr>
+ <tr>
+ <td colspan="2">This option specifies if Tidy should omit optional start tags and end tags when generating output. Setting this option causes all tags for the html, head, and body elements to be omitted from output, as well as such end tags as &lt;/p&gt;, &lt;/li&gt;, &lt;/dt&gt;, &lt;/dd&gt;, &lt;/option&gt;, &lt;/tr&gt;, &lt;/td&gt;, and &lt;/th&gt;. This option is ignored for XML output. </td>
+ </tr>
+ <tr>
+ <td>&#160;</td>
+ </tr>
+ <tr>
<td class="tabletitle" valign="top" id="output-html">output-html</td>
<td class="tabletitlelink" valign="top" align="right">
<a href="#top">Top</a>
View
@@ -240,6 +240,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyQuiet, MS, "quiet", BL, no, ParseBool, boolPicks },
{ TidyIndentContent, PP, "indent", IN, TidyNoState, ParseAutoBool, autoBoolPicks },
{ TidyCoerceEndTags, MU, "coerce-endtags", BL, yes, ParseBool, boolPicks },
+ { TidyOmitOptionalTags, MU, "omit-optional-tags", BL, no, ParseBool, boolPicks },
{ TidyHideEndTags, MU, "hide-endtags", BL, no, ParseBool, boolPicks },
{ TidyXmlTags, MU, "input-xml", BL, no, ParseBool, boolPicks },
{ TidyXmlOut, MU, "output-xml", BL, no, ParseBool, boolPicks },
View
@@ -479,10 +479,16 @@ static const TidyOptionDoc option_docs[] =
"for example, given &lt;span&gt;foo &lt;b&gt;bar&lt;b&gt; baz&lt;/span&gt;, "
"Tidy will output &lt;span&gt;foo &lt;b&gt;bar&lt;/b&gt; baz&lt;/span&gt;. "
},
+ {TidyOmitOptionalTags,
+ "This option specifies if Tidy should omit optional start tags and end tags "
+ "when generating output. Setting this option causes all tags for the "
+ "html, head, and body elements to be omitted from output, as well as such "
+ "end tags as &lt;/p&gt;, &lt;/li&gt;, &lt;/dt&gt;, &lt;/dd&gt;, "
+ "&lt;/option&gt;, &lt;/tr&gt;, &lt;/td&gt;, and &lt;/th&gt;. "
+ "This option is ignored for XML output. "
+ },
{TidyHideEndTags,
- "This option specifies if Tidy should omit optional end-tags when "
- "generating the pretty printed markup. This option is ignored if you are "
- "outputting to XML. "
+ "This option is an alias for the omit-optional-tags option. "
},
{TidyIndentCdata,
"This option specifies if Tidy should indent &lt;![CDATA[]]&gt; sections. "
View
@@ -2089,7 +2089,8 @@ 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 );
+ Bool hideend = cfgBool( doc, TidyHideEndTags ) ||
+ cfgBool( doc, TidyOmitOptionalTags );
Bool classic = cfgBool( doc, TidyVertSpace );
uint contentIndent = indent;
View
@@ -1 +1 @@
-static const char TY_(release_date)[] = "https://github.com/w3c/tidy-html5/tree/4ff3234";
+static const char TY_(release_date)[] = "https://github.com/w3c/tidy-html5/tree/f5c2739";

0 comments on commit 2cd21a6

Please sign in to comment.