Skip to content

added script-no-first-blank-line option #1131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/tidyenum.h
Original file line number Diff line number Diff line change
@@ -652,6 +652,7 @@ typedef enum
TidyUpperCaseTags, /**< Output tags in upper not lower case */
TidyUseCustomTags, /**< Enable Tidy to use autonomous custom tags */
TidyVertSpace, /**< degree to which markup is spread out vertically */
TidyScriptNoFirstBlankLine, /**< Control blank line insertion after <script> tags */
TidyWarnPropAttrs, /**< Warns on proprietary attributes */
TidyWord2000, /**< Draconian cleaning for Word2000 */
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
@@ -259,6 +259,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyUpperCaseTags, MR, "uppercase-tags", BL, no, ParsePickList, &boolPicks },
{ TidyUseCustomTags, MR, "custom-tags", IN, TidyCustomNo, ParsePickList, &customTagsPicks }, /* 20170309 - Issue #119 */
{ TidyVertSpace, PP, "vertical-space", IN, no, ParsePickList, &autoBoolPicks }, /* #228 - tri option */
{ TidyScriptNoFirstBlankLine, PP, "script-no-first-blank-line", BL, no, ParsePickList, &boolPicks },
{ TidyWarnPropAttrs, DG, "warn-proprietary-attributes", BL, yes, ParsePickList, &boolPicks },
{ TidyWord2000, MC, "word-2000", BL, no, ParsePickList, &boolPicks },
{ TidyWrapAsp, PP, "wrap-asp", BL, yes, ParsePickList, &boolPicks },
18 changes: 18 additions & 0 deletions src/language_en.h
Original file line number Diff line number Diff line change
@@ -1398,6 +1398,24 @@ static languageDefinition language_en = { whichPluralForm_en, {
"If set to <var>auto</var> Tidy will eliminate nearly all newline "
"characters."
},
{/* Important notes for translators:
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
<br/>.
- Entities, tags, attributes, etc., should be enclosed in <code></code>.
- Option values should be enclosed in <var></var>.
- It's very important that <br/> be self-closing!
- The strings "Tidy" and "HTML Tidy" are the program name and must not
be translated. */
TidyScriptNoFirstBlankLine, 0,
"This option controls whether Tidy adds a single blank line after the "
"<code>&lt;script&gt;</code> opening tag for readability. "
"<br/>"
"The default is <var>no</var>, which adds a single blank line after "
"the <code>&lt;script&gt;</code> tag. "
"<br/>"
"If set to <var>yes</var>, Tidy will suppress the blank line immediately "
"after the <code>&lt;script&gt;</code> tag."
},
{/* Important notes for translators:
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
<br/>.
3 changes: 3 additions & 0 deletions src/pprint.c
Original file line number Diff line number Diff line change
@@ -2139,7 +2139,10 @@ static void PPrintScriptStyle( TidyDocImpl* doc, uint mode, uint indent, Node *n
In this case we don't want to flush the line, preferring to keep the required
closing SCRIPT tag on the same line. */
if ( node->content != NULL )
{
if (!cfgBool(doc, TidyScriptNoFirstBlankLine))
PFlushLineSmart(doc, indent);
}

if ( xhtmlOut && node->content != NULL )
{