Fix indent-with-tabs for library use.

This commit is contained in:
Jim Derry 2015-11-04 12:44:15 +08:00
parent 0706d195ef
commit 32ce272f75
2 changed files with 6 additions and 2 deletions

View file

@ -1229,10 +1229,8 @@ Bool ParseTabs( TidyDocImpl* doc, const TidyOptionImpl* entry )
Bool tabs = flag != 0 ? yes : no;
TY_(SetOptionBool)( doc, entry->id, tabs );
if (tabs) {
TY_(PPrintTabs)();
TY_(SetOptionInt)( doc, TidyIndentSpaces, 1 );
} else {
TY_(PPrintSpaces)();
/* optional - TY_(ResetOptionToDefault)( doc, TidyIndentSpaces ); */
}
}

View file

@ -1809,8 +1809,14 @@ int tidyDocSaveStream( TidyDocImpl* doc, StreamOut* out )
Bool asciiChars = cfgBool(doc, TidyAsciiChars);
Bool makeBare = cfgBool(doc, TidyMakeBare);
Bool escapeCDATA = cfgBool(doc, TidyEscapeCdata);
Bool ppWithTabs = cfgBool(doc, TidyPPrintTabs);
TidyAttrSortStrategy sortAttrStrat = cfg(doc, TidySortAttributes);
if (ppWithTabs)
TY_(PPrintTabs)();
else
TY_(PPrintSpaces)();
if (escapeCDATA)
TY_(ConvertCDATANodes)(doc, &doc->root);