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:
@@ -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,6 +2077,7 @@ 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
|
||||
@@ -2088,9 +2089,15 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
bool replaceit = shouldReplace[(E_ReplaceFlags)rs.Flag];
|
||||
|
||||
if (replaceit)
|
||||
{
|
||||
// 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(":"))
|
||||
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
|
||||
{
|
||||
|
Reference in New Issue
Block a user