diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs index 2288d018..d1a6fdad 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs @@ -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))] diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 1426b645..c1be9e2f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -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) { diff --git a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs index 9e90e718..c3b552e1 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs @@ -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 {