From f49386e19121d392cfe7605329944f5127c9d14c Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Sun, 22 Nov 2020 16:44:31 +0100 Subject: [PATCH] Issue #437 - re-use of 'wrap-php' option (#645) closes #437 --- include/tidyenum.h | 2 +- src/config.c | 2 +- src/language_en.h | 2 +- src/pprint.c | 12 +++++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index 23a98f7..c54c87c 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -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 */ diff --git a/src/config.c b/src/config.c index 9b59ec1..bae56b8 100644 --- a/src/config.c +++ b/src/config.c @@ -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 }, diff --git a/src/language_en.h b/src/language_en.h index eab5567..a77433c 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -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: <?php ... ?>. " }, {/* Important notes for translators: diff --git a/src/pprint.c b/src/pprint.c index 321045e..7ef47c8 100644 --- a/src/pprint.c +++ b/src/pprint.c @@ -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, "" ); - /* 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 )