B2019-037 added logic to replace ~ and # characters with superscript and subscript commands

This commit is contained in:
John Jenko 2019-04-17 17:06:37 +00:00
parent b970920ee5
commit 70692e9d77
4 changed files with 14 additions and 7 deletions

View File

@ -216,11 +216,18 @@ namespace VEPROMS.CSLA.Library
// return null; // return null;
//} //}
public string GetTranslatedRoValue(string ROID16, bool DoCaret) public string GetTranslatedRoValue(string ROID16, bool DoCaret, bool DoDOSSuperSubScript)
{ {
string retval = GetRoValue(ROID16); string retval = GetRoValue(ROID16);
retval = ReplaceUnicode(retval, DoCaret); retval = ReplaceUnicode(retval, DoCaret);
retval = ConvertFortranFormatToScienctificNotation(retval); retval = ConvertFortranFormatToScienctificNotation(retval);
// B2019-037 handle the super an sub scripts after getting the RO value from the FST
// the corrected RO text is added to the display text in the link info
if (DoDOSSuperSubScript)
{
retval = Regex.Replace(retval, "[#](.*?)[#]", "\\up2 $1\\up0 ");// Superscript
retval = Regex.Replace(retval, "[~](.*?)[~]", "\\dn2 $1\\up0 ");// Subscript
}
return retval.Replace("\r\n", @"\par "); return retval.Replace("\r\n", @"\par ");
} }
private string ReplaceUnicode(string s2, bool DoCaret) private string ReplaceUnicode(string s2, bool DoCaret)

View File

@ -1616,7 +1616,7 @@ namespace VEPROMS.CSLA.Library
foreach (ContentRoUsage ro in cont.ContentRoUsages) foreach (ContentRoUsage ro in cont.ContentRoUsages)
{ {
RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID); RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID);
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID); ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
int mytype = rocc.type; int mytype = rocc.type;
cont.FixContentText(rou, myvalue, mytype, myRoFst); cont.FixContentText(rou, myvalue, mytype, myRoFst);
@ -1840,7 +1840,7 @@ namespace VEPROMS.CSLA.Library
ROFSTLookup mylookup = myRoFst.GetROFSTLookup(tmp.ContentItems[0].MyProcedure.MyDocVersion); ROFSTLookup mylookup = myRoFst.GetROFSTLookup(tmp.ContentItems[0].MyProcedure.MyDocVersion);
foreach (RoUsageInfo rou in tmp.ContentRoUsages) foreach (RoUsageInfo rou in tmp.ContentRoUsages)
{ {
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID); ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
int mytype = rocc.type; int mytype = rocc.type;
ctmp.FixContentText(rou, myvalue, mytype, myRoFst); ctmp.FixContentText(rou, myvalue, mytype, myRoFst);

View File

@ -843,7 +843,7 @@ namespace VEPROMS.CSLA.Library
if (this.ActiveSection != null) if (this.ActiveSection != null)
{ {
string oldText = this.MyContent.Text; string oldText = this.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID); ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this); this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
string newText = this.MyContent.Text; string newText = this.MyContent.Text;
@ -890,7 +890,7 @@ namespace VEPROMS.CSLA.Library
{ {
ROCheckCount++; ROCheckCount++;
string oldText = itemInfo.MyContent.Text; string oldText = itemInfo.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID); ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo); itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
string newText = itemInfo.MyContent.Text; string newText = itemInfo.MyContent.Text;
@ -1039,7 +1039,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (sectionInfo != null) if (sectionInfo != null)
{ {
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID); ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo); itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
} }

View File

@ -607,7 +607,7 @@ namespace VEPROMS.CSLA.Library
{ {
foreach (ItemInfo ii in roUsg.MyContent.ContentItems) foreach (ItemInfo ii in roUsg.MyContent.ContentItems)
{ {
string val = newLU.GetTranslatedRoValue(padroid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string val = newLU.GetTranslatedRoValue(padroid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, ii.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
content.FixContentText(roUsg, val, roch.type, origROFstInfo, true); content.FixContentText(roUsg, val, roch.type, origROFstInfo, true);
if (content.IsDirty) if (content.IsDirty)
{ {