Skip to content

Commit f49386e

Browse files
authored
Issue #437 - re-use of 'wrap-php' option (#645)
closes #437
1 parent a2065f8 commit f49386e

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

include/tidyenum.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ typedef enum
657657
TidyWrapAttVals, /**< Wrap within attribute values */
658658
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
659659
TidyWrapLen, /**< Wrap margin */
660-
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
660+
TidyWrapPhp, /**< Wrap consecutive PHP pseudo elements */
661661
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
662662
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
663663
TidyWriteBack, /**< If true then output tidied markup */

src/config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static const TidyOptionImpl option_defs[] =
265265
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParsePickList, &boolPicks },
266266
{ TidyWrapJste, PP, "wrap-jste", BL, yes, ParsePickList, &boolPicks },
267267
{ TidyWrapLen, PP, "wrap", IN, 68, ParseInt, NULL },
268-
{ TidyWrapPhp, PP, "wrap-php", BL, yes, ParsePickList, &boolPicks },
268+
{ TidyWrapPhp, PP, "wrap-php", BL, no, ParsePickList, &boolPicks },
269269
{ TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParsePickList, &boolPicks },
270270
{ TidyWrapSection, PP, "wrap-sections", BL, yes, ParsePickList, &boolPicks },
271271
{ TidyWriteBack, IO, "write-back", BL, no, ParsePickList, &boolPicks },

src/language_en.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
14921492
- The strings "Tidy" and "HTML Tidy" are the program name and must not
14931493
be translated. */
14941494
TidyWrapPhp, 0,
1495-
"This option specifies if Tidy should line wrap text contained within PHP "
1495+
"This option specifies if Tidy should add a new line after a PHP "
14961496
"pseudo elements, which look like: <code>&lt;?php ... ?&gt;</code>. "
14971497
},
14981498
{/* Important notes for translators:

src/pprint.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -1699,15 +1699,17 @@ static void PPrintPhp( TidyDocImpl* doc, uint indent, Node *node )
16991699
{
17001700
TidyPrintImpl* pprint = &doc->pprint;
17011701
Bool wrapPhp = cfgBool( doc, TidyWrapPhp );
1702-
uint saveWrap = WrapOffCond( doc, !wrapPhp );
1702+
/* uint saveWrap = WrapOffCond( doc, !wrapPhp ); */
17031703

17041704
AddString( pprint, "<?" );
1705-
PPrintText( doc, (wrapPhp ? CDATA : COMMENT),
1706-
indent, node );
1705+
PPrintText( doc, CDATA, indent, node );
17071706
AddString( pprint, "?>" );
17081707

1709-
/* PCondFlushLine( doc, indent ); */
1710-
WrapOn( doc, saveWrap );
1708+
/* Issue #437 - add a new line if 'wrap-php' is on */
1709+
if (wrapPhp)
1710+
PCondFlushLine( doc, indent );
1711+
1712+
/* WrapOn( doc, saveWrap ); */
17111713
}
17121714

17131715
static void PPrintCDATA( TidyDocImpl* doc, uint indent, Node *node )

0 commit comments

Comments
 (0)