Issue #437 - re-use of 'wrap-php' option (#645)

closes #437
This commit is contained in:
Geoff McLane 2020-11-22 16:44:31 +01:00 committed by GitHub
parent a2065f8283
commit f49386e191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View file

@ -657,7 +657,7 @@ typedef enum
TidyWrapAttVals, /**< Wrap within attribute values */
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
TidyWrapLen, /**< Wrap margin */
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyWrapPhp, /**< Wrap consecutive PHP pseudo elements */
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
TidyWriteBack, /**< If true then output tidied markup */

View file

@ -265,7 +265,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParsePickList, &boolPicks },
{ TidyWrapJste, PP, "wrap-jste", BL, yes, ParsePickList, &boolPicks },
{ TidyWrapLen, PP, "wrap", IN, 68, ParseInt, NULL },
{ TidyWrapPhp, PP, "wrap-php", BL, yes, ParsePickList, &boolPicks },
{ TidyWrapPhp, PP, "wrap-php", BL, no, ParsePickList, &boolPicks },
{ TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParsePickList, &boolPicks },
{ TidyWrapSection, PP, "wrap-sections", BL, yes, ParsePickList, &boolPicks },
{ TidyWriteBack, IO, "write-back", BL, no, ParsePickList, &boolPicks },

View file

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

View file

@ -1699,15 +1699,17 @@ static void PPrintPhp( TidyDocImpl* doc, uint indent, Node *node )
{
TidyPrintImpl* pprint = &doc->pprint;
Bool wrapPhp = cfgBool( doc, TidyWrapPhp );
uint saveWrap = WrapOffCond( doc, !wrapPhp );
/* uint saveWrap = WrapOffCond( doc, !wrapPhp ); */
AddString( pprint, "<?" );
PPrintText( doc, (wrapPhp ? CDATA : COMMENT),
indent, node );
PPrintText( doc, CDATA, indent, node );
AddString( pprint, "?>" );
/* PCondFlushLine( doc, indent ); */
WrapOn( doc, saveWrap );
/* Issue #437 - add a new line if 'wrap-php' is on */
if (wrapPhp)
PCondFlushLine( doc, indent );
/* WrapOn( doc, saveWrap ); */
}
static void PPrintCDATA( TidyDocImpl* doc, uint indent, Node *node )