C2021-045 add BeforeList ReplaceWords flag

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

View File

@ -301,7 +301,8 @@ namespace VEPROMS.CSLA.Library
Partials = 0x10000, // Do replace even on partial matches
Plackeep = 0x20000, // Do replace in PlaceKeepers
InSecTitle = 0x40000,
BeforeTrans = 0x80000 // Only do replace if the string occurs immediately before a transition.
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
}
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]

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))

View File

@ -227,7 +227,8 @@ namespace VEPROMS.CSLA.Library
Partials = 0x10000, // Do replace even on partial matches
Plackeep = 0x20000, // Do replace in PlaceKeepers
InSecTitle = 0x40000,
BeforeTrans = 0x80000 // Only do replace if the string occurs immediately before a transition.
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
}
public enum E_ArrowKeys : uint
{