Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ static const struct {


/* forward declarations */
static void AdjustConfig( TidyDocImpl* doc );
static Bool GetPickListValue( ctmbstr value, PickListItems* pickList, uint *result );


Expand Down Expand Up @@ -711,6 +712,7 @@ void TY_(TakeConfigSnapshot)( TidyDocImpl* doc )
const TidyOptionValue* value = &doc->config.value[ 0 ];
TidyOptionValue* snap = &doc->config.snapshot[ 0 ];

AdjustConfig( doc ); /* Make sure it's consistent */
for ( ixVal=0; ixVal < N_TIDY_OPTIONS; ++option, ++ixVal )
{
assert( ixVal == (uint) option->id );
Expand Down Expand Up @@ -759,6 +761,7 @@ void TY_(CopyConfig)( TidyDocImpl* docTo, TidyDocImpl* docFrom )
}
if ( needReparseTagsDecls )
ReparseTagDecls( docTo, changedUserTags );
AdjustConfig( docTo ); /* Make sure it's consistent */
}
}

Expand Down Expand Up @@ -1052,6 +1055,8 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
if ( fname != (tmbstr) file )
TidyDocFree( doc, fname );

AdjustConfig( doc );

/* any new config errors? If so, return warning status. */
return (doc->optionErrors > opterrs ? 1 : 0);
}
Expand Down Expand Up @@ -1190,7 +1195,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )


/* ensure that config is self consistent */
void TY_(AdjustConfig)( TidyDocImpl* doc )
static void AdjustConfig( TidyDocImpl* doc )
{
if ( cfgBool(doc, TidyEncloseBlockText) )
TY_(SetOptionBool)( doc, TidyEncloseBodyText, yes );
Expand Down
6 changes: 0 additions & 6 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,6 @@ Bool TY_(ParseConfigValue)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optVa
Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding );


/** Ensure that the configuration options are self consistent.
** @param doc The Tidy document to adjust.
*/
void TY_(AdjustConfig)( TidyDocImpl* doc );


/** Indicates whether or not the current configuration is completely default.
** @param doc The Tidy document.
** @returns The result.
Expand Down
1 change: 0 additions & 1 deletion src/tidylib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,6 @@ int TY_(DocParseStream)( TidyDocImpl* doc, StreamIn* in )

TY_(ResetTags)(doc); /* reset table to html5 mode */
TY_(TakeConfigSnapshot)( doc ); /* Save config state */
TY_(AdjustConfig)( doc ); /* ensure config consistency */
TY_(FreeAnchors)( doc );

TY_(FreeNode)(doc, &doc->root);
Expand Down