B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
This commit is contained in:
parent
2cbf0d2515
commit
672cdf7ef4
@ -1304,7 +1304,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//if (TranGetSectionItem(itminfo).IsDefaultSection) return;
|
//if (TranGetSectionItem(itminfo).IsDefaultSection) return;
|
||||||
StringBuilder retstr = new StringBuilder();
|
StringBuilder retstr = new StringBuilder();
|
||||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
//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;
|
string txt;
|
||||||
if(retstr.Length > 0)
|
if(retstr.Length > 0)
|
||||||
txt = TranGetSectionTitle(tb,tb._ToItem);
|
txt = TranGetSectionTitle(tb,tb._ToItem);
|
||||||
@ -1335,7 +1335,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tb._ToItem.IsSection) return false;
|
if (tb._ToItem.IsSection) return false;
|
||||||
tb.AppendPrefix();
|
tb.AppendPrefix();
|
||||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
//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);
|
tb.ReplaceToken(retstr);
|
||||||
return (retstr != null && retstr != "");
|
return (retstr != null && retstr != "");
|
||||||
}
|
}
|
||||||
@ -1374,7 +1374,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tb.SectionsUsed.Contains(tb._ToItem.ItemID))
|
if (tb.SectionsUsed.Contains(tb._ToItem.ItemID))
|
||||||
return false;
|
return false;
|
||||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
//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);
|
tb.SectionsUsed.Add(tb._ToItem.ItemID);
|
||||||
if (retstr != null && retstr != "")
|
if (retstr != null && retstr != "")
|
||||||
{
|
{
|
||||||
@ -1393,7 +1393,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return (retstr != null && retstr != "");
|
return (retstr != null && retstr != "");
|
||||||
}
|
}
|
||||||
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
|
//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;
|
if (str == null) return str;
|
||||||
return str.TrimStart();
|
return str.TrimStart();
|
||||||
@ -1511,10 +1511,18 @@ namespace VEPROMS.CSLA.Library
|
|||||||
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
||||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
||||||
sectionTitle);
|
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;
|
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)
|
private static string TranGetSectionTitle(TransitionBuilder tb, ItemInfo itminfo, bool overRide)
|
||||||
{
|
{
|
||||||
// LATER: Cap1stSectionTitle, CapFirstLetterOnly
|
// LATER: Cap1stSectionTitle, CapFirstLetterOnly
|
||||||
@ -1525,7 +1533,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
|
||||||
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) :
|
||||||
sectionTitle);
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user