/// <summary> /// Formats the author. /// </summary> /// <param name="authors">The authors.</param> /// <param name="nametype">The nametype.</param> /// <returns></returns> public static string FormatAuthor(List<NameMasterRow> authors, Author authorTemplate, NameTypes nametype, bool bIsInHtmlFormat) { string text = string.Empty; string strFollowedBy = string.Empty; List<NameMasterRow> listAuthors = new List<NameMasterRow>(); foreach (NameMasterRow author in authors) { if (author.NameTypeID == nametype) { if(author.LastName.Length > 0) listAuthors.Add(author); } } int count = listAuthors.Count; if (count >= authorTemplate.MaxAuthors) { if (count > authorTemplate.ListAuthors) count = authorTemplate.ListAuthors; } for (int i = 0; i < count; i++) { AuthorFormat formatIndex = authorTemplate.OtherAuthors; if (i == 0) formatIndex = authorTemplate.FirstAuthor; if (text.Length > 0) { if (i < count - 1) text += CitationTools.GetAuthorDelimitor(authorTemplate.BetweenAuthors); else text += authorTemplate.BeforeLast; } string authorname = CitationTools.FormatName(listAuthors[i], formatIndex); switch (authorTemplate.Capitalization) { case Capitalization.AsIs: break; case Capitalization.FirstIsCapital: authorname = authorname.Substring(0, 1).ToUpper() + authorname.Substring(1).ToLower(); break; case Capitalization.AllCapital: authorname = authorname.ToUpper(); break; } text += authorname.Replace("<", "<").Replace(">", ">"); } if (listAuthors.Count >= authorTemplate.MaxAuthors) { if (authorTemplate.FollowedBy_Italic) { if(bIsInHtmlFormat) text += "<i>" + authorTemplate.FollowedBy + "</i>"; else strFollowedBy = GetWordMLFormatString(authorTemplate.FollowedBy, TextFormat.Italic); } else text += authorTemplate.FollowedBy; } text = ApplyStandardFormat(authorTemplate, text, bIsInHtmlFormat, strFollowedBy, false); return text; }
public InTextFields() { Author = new Author(); Year = new Year(); Number = new Number(); Pages = new Pages(); }