C2021-045 add BeforeList ReplaceWords flag

C2021-045 add logic to support BeforeList ReplaceWords flag
This commit is contained in:
2021-10-13 17:55:15 +00:00
parent 7d8601c9e8
commit be5bb48f82
3 changed files with 11 additions and 3 deletions

View File

@@ -2051,6 +2051,8 @@ namespace VEPROMS.CSLA.Library
foreach (FormatConfig.ReplaceStr rs in rsl)
{
bool dopartial = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.Partials) == E_ReplaceFlags.Partials;
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
// note that the order of this check is important. Check in this order...
// background here
if (!shouldReplace.ContainsKey((E_ReplaceFlags)rs.Flag))
@@ -2060,7 +2062,11 @@ namespace VEPROMS.CSLA.Library
//ProfileTimer.Pop(profileDepth2);
}
bool replaceit = shouldReplace[(E_ReplaceFlags)rs.Flag];
// C2021-045 if the BeforeList ReplaceWords flag is set, only do the replace word if the text ends with a colon
if (replaceit && onlyDoList && !Text.EndsWith(":"))
replaceit = false; // text does not end with a colon so don't replace this word
if (replaceit)
{
if (!dicReplaceRegex.ContainsKey(rs))