B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.

This commit is contained in:
Rich 2017-10-20 13:13:38 +00:00
parent 2cbf0d2515
commit 672cdf7ef4

View File

@ -1304,7 +1304,7 @@ namespace VEPROMS.CSLA.Library
//if (TranGetSectionItem(itminfo).IsDefaultSection) return;
StringBuilder retstr = new StringBuilder();
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
retstr.Append(TrimIt(TranGetSectionNumber(tb,false)));
retstr.Append(TrimSectNumber(TranGetSectionNumber(tb,false)));
string txt;
if(retstr.Length > 0)
txt = TranGetSectionTitle(tb,tb._ToItem);
@ -1335,7 +1335,7 @@ namespace VEPROMS.CSLA.Library
if (tb._ToItem.IsSection) return false;
tb.AppendPrefix();
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
string retstr = TrimIt(TranGetSectionNumber(tb, false));
string retstr = TrimSectNumber(TranGetSectionNumber(tb, false));
tb.ReplaceToken(retstr);
return (retstr != null && retstr != "");
}
@ -1374,7 +1374,7 @@ namespace VEPROMS.CSLA.Library
if (tb.SectionsUsed.Contains(tb._ToItem.ItemID))
return false;
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
string retstr = TrimIt(TranGetSectionNumber(tb, allLevels));
string retstr = TrimSectNumber(TranGetSectionNumber(tb, allLevels));
tb.SectionsUsed.Add(tb._ToItem.ItemID);
if (retstr != null && retstr != "")
{
@ -1393,7 +1393,7 @@ namespace VEPROMS.CSLA.Library
return (retstr != null && retstr != "");
}
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
private static string TrimIt(string str)
private static string TrimSectNumber(string str)
{
if (str == null) return str;
return str.TrimStart();
@ -1511,10 +1511,18 @@ namespace VEPROMS.CSLA.Library
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
sectionTitle);
return (sectionTitle);
// B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
return TrimSectionTitle(sectionTitle);
}
return null;
}
// B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
private static string TrimSectionTitle(string sectionTitle)
{
if (sectionTitle == null) return sectionTitle;//Check for null
sectionTitle = Regex.Replace(sectionTitle, @"(\\(line|par) ?)+", " ");//replace hard and soft returns with spaces
return sectionTitle.TrimEnd();//Trim the spaces for the end of the section title
}
private static string TranGetSectionTitle(TransitionBuilder tb, ItemInfo itminfo, bool overRide)
{
// LATER: Cap1stSectionTitle, CapFirstLetterOnly
@ -1525,7 +1533,8 @@ namespace VEPROMS.CSLA.Library
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
sectionTitle);
return (sectionTitle);
// B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
return TrimSectionTitle(sectionTitle);
}
return null;
}