private static string FormatField(DocProject docProject, string content, string fieldname, string fieldtype, string fieldvalue) { DocDefinition docDef = docProject.GetDefinition(fieldtype); // hyperlink to enumerators if (docDef is DocEnumeration) { // hyperlink to enumeration definition // replace it with hyperlink DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef); string relative = @"../../"; string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm"; string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>"; return content.Replace(fieldname, format); } else if (docDef is DocEntity)//fieldvalue != null && fieldvalue.StartsWith("Ifc") && docProject.GetDefinition(fieldvalue) != null) { // replace it with hyperlink DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef); string relative = @"../../"; string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm"; string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>"; return content.Replace(fieldname, format); } else //if (docDef == null) { // hyperlink to property set definition DocSchema docSchema = null; DocObject docObj = docProject.FindPropertySet(fieldvalue, out docSchema); if (docObj is DocPropertySet) { string relative = @"../../"; string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/pset/" + docObj.Name.ToLower() + ".htm"; // case-sensitive on linux -- need to make schema all lowercase string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>"; return content.Replace(fieldname, format); } else if (docObj is DocQuantitySet) { string relative = @"../../"; string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/qset/" + docObj.Name.ToLower() + ".htm"; // case-sentive on linux -- need to make schema all lowercase string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>"; return content.Replace(fieldname, format); } if (docObj == null) { // simple replace -- hyperlink may markup value later return content.Replace(fieldname, fieldvalue); } } /* else { // simple replace -- hyperlink may markup value later return content.Replace(fieldname, fieldvalue); }*/ return content; }