Skip to content

Commit

Permalink
Added show-info option. Fixes #6.
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowbarker committed Apr 2, 2012
1 parent 880221e commit d194e87
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/tidyenum.h
Expand Up @@ -108,6 +108,7 @@ typedef enum
TidyOutFile, /**< File name to write markup to */
TidyWriteBack, /**< If true then output tidied markup */
TidyShowMarkup, /**< If false, normal output is suppressed */
TidyShowInfo, /**< If true, info-level messages are shown */
TidyShowWarnings, /**< However errors are always shown */
TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */
TidyIndentContent, /**< Indent content of appropriate tags */
Expand Down
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -376,6 +376,7 @@ <h2 id="new-config">New configuration options</h2>
<li><a href="http://w3c.github.com/tidy-html5/quickref.html#drop-empty-elements">drop-empty-elements</a>
<li><a href="http://w3c.github.com/tidy-html5/quickref.html#merge-emphasis">merge-emphasis</a>
<li><a href="http://w3c.github.com/tidy-html5/quickref.html#omit-optional-tags">omit-optional-tags</a>
<li><a href="http://w3c.github.com/tidy-html5/quickref.html#show-info">show-info</a>
</ul>
<p>In addition, it also adds a new <code>html5</code> value for the
<a href="http://w3c.github.com/tidy-html5/quickref.html#doctype">doctype</a>
Expand Down
26 changes: 25 additions & 1 deletion quickref.html
Expand Up @@ -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/abc1e3f">https://github.com/w3c/tidy-html5/tree/abc1e3f</a></p>
<p>Version: <a href="https://github.com/w3c/tidy-html5/tree/1f21625">https://github.com/w3c/tidy-html5/tree/1f21625</a></p>
<p>
<a class="h3" href="#MarkupHeader">HTML, XHTML, XML</a>
<br />
Expand Down Expand Up @@ -448,6 +448,13 @@ <h2>HTML Tidy Configuration Options</h2>
<td>Integer</td>
<td>6</td>
</tr>
<tr>
<td>
<a href="#show-info">show-info</a>
</td>
<td>Boolean</td>
<td>yes</td>
</tr>
<tr>
<td>
<a href="#show-warnings">show-warnings</a>
Expand Down Expand Up @@ -1763,6 +1770,23 @@ <h2>HTML Tidy Configuration Options</h2>
<tr>
<td>&#160;</td>
</tr>
<tr>
<td class="tabletitle" valign="top" id="show-info">show-info</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>yes</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 display info-level messages. </td>
</tr>
<tr>
<td>&#160;</td>
</tr>
<tr>
<td class="tabletitle" valign="top" id="show-warnings">show-warnings</td>
<td class="tabletitlelink" valign="top" align="right">
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Expand Up @@ -236,6 +236,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyOutFile, MS, "output-file", ST, 0, ParseString, NULL },
{ TidyWriteBack, MS, "write-back", BL, no, ParseBool, boolPicks },
{ TidyShowMarkup, PP, "markup", BL, yes, ParseBool, boolPicks },
{ TidyShowInfo, DG, "show-info", BL, yes, ParseBool, boolPicks },
{ TidyShowWarnings, DG, "show-warnings", BL, yes, ParseBool, boolPicks },
{ TidyQuiet, MS, "quiet", BL, no, ParseBool, boolPicks },
{ TidyIndentContent, PP, "indent", IN, TidyNoState, ParseAutoBool, autoBoolPicks },
Expand Down
5 changes: 5 additions & 0 deletions src/localize.c
Expand Up @@ -681,6 +681,9 @@ static const TidyOptionDoc option_docs[] =
"This option specifies the number Tidy uses to determine if further errors "
"should be shown. If set to 0, then no errors are shown. "
},
{TidyShowInfo,
"This option specifies if Tidy should display info-level messages. "
},
{TidyShowWarnings,
"This option specifies if Tidy should suppress warnings. This can be "
"useful when a few errors are hidden in a flurry of warnings. "
Expand Down Expand Up @@ -1083,6 +1086,7 @@ __attribute__((format(printf, 2, 3)))

void message( TidyDocImpl* doc, TidyReportLevel level, ctmbstr msg, ... )
{
if (level == TidyInfo && !cfgBool(doc, TidyShowInfo)) return;
va_list args;
va_start( args, msg );
messagePos( doc, level, 0, 0, msg, args );
Expand Down Expand Up @@ -1812,6 +1816,7 @@ void TY_(NeedsAuthorIntervention)( TidyDocImpl* doc )

void TY_(GeneralInfo)( TidyDocImpl* doc )
{
if (!cfgBool(doc, TidyShowInfo)) return;
tidy_out(doc, "About this fork of Tidy: http://w3c.github.com/tidy-html5/\n");
tidy_out(doc, "Bug reports and comments: https://github.com/w3c/tidy-html5/issues/\n");
tidy_out(doc, "Or send questions and comments to html-tidy@w3.org\n");
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
@@ -1 +1 @@
static const char TY_(release_date)[] = "https://github.com/w3c/tidy-html5/tree/1f21625";
static const char TY_(release_date)[] = "https://github.com/w3c/tidy-html5/tree/880221e";

0 comments on commit d194e87

Please sign in to comment.