C2021-056 Added FirstWord flag to ReplaceWords
C2021-056 Added logic to support the FirstWord flag in ReplaceWords. When set, the word will be replaced only if it the first word in the text.
This commit is contained in:
parent
2e8e01e8ab
commit
8755e9f0ad
@ -303,7 +303,8 @@ namespace VEPROMS.CSLA.Library
|
||||
InSecTitle = 0x40000,
|
||||
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 ":"
|
||||
PageList = 0x200000 // F2021-053 Do replace words for PageList items that are ROs
|
||||
PageList = 0x200000, // F2021-053 Do replace words for PageList items that are ROs
|
||||
FirstWord = 0x400000 // C2021-056 Do only if is the first word in the text
|
||||
}
|
||||
[Serializable]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
|
@ -2077,10 +2077,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
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
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
|
||||
// note that the order of this check is important. Check in this order...
|
||||
// background here
|
||||
if (!shouldReplace.ContainsKey((E_ReplaceFlags)rs.Flag))
|
||||
if (!shouldReplace.ContainsKey((E_ReplaceFlags)rs.Flag))
|
||||
{
|
||||
//int profileDepth2 = ProfileTimer.Push(">>>> Before ShouldReplaceIt");
|
||||
shouldReplace.Add((E_ReplaceFlags)rs.Flag, ShouldReplaceIt((E_ReplaceFlags)rs.Flag));
|
||||
@ -2088,9 +2089,15 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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)
|
||||
{
|
||||
// C2021-045 if the BeforeList ReplaceWords flag is set, only do the replace word if the text ends with a colon
|
||||
if (onlyDoList && !Text.EndsWith(":"))
|
||||
replaceit = false; // text does not end with a colon so don't replace this word
|
||||
// C2021-056 if FirstWord ReplaceWords flag is set, only do if the replace word is the first word in the text
|
||||
if (onlyIfFirstWord && !Text.StartsWith(rs.ReplaceWord))
|
||||
replaceit = false;
|
||||
}
|
||||
if (!replaceit && _DoReplWordInPageList) replaceit = true; // F2021-053: Do replace words in page list
|
||||
if (replaceit)
|
||||
{
|
||||
|
@ -229,7 +229,8 @@ namespace VEPROMS.CSLA.Library
|
||||
InSecTitle = 0x40000,
|
||||
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 ":"
|
||||
PageList = 0x200000 // F2021-053: Do replace words in page list
|
||||
PageList = 0x200000, // F2021-053: Do replace words in page list
|
||||
FirstWord = 0x400000 // C2021-056 Do only if is the first word in the text
|
||||
}
|
||||
public enum E_ArrowKeys : uint
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user