public static void RenderResults(HtmlWriter writer, SearchRecord[] records, bool renderUl = true) { var visibleCategorizations = CategorizationFolder.GetVisibleCategorizations(); var newsListUrl = Urls.GetMainNewsListUrl(); if (renderUl) writer.RenderBeginTag(HtmlTextWriterTag.Ul, "news-list"); foreach (var record in records) { var date = record.GetDate("date"); writer.RenderBeginTag(HtmlTextWriterTag.Li, "clearfix"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Href, record.GetString("url")); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.RenderFullTag(HtmlTextWriterTag.H3, record.GetString("title")); writer.RenderEndTag(); // a if (date != null) writer.RenderFullTag(HtmlTextWriterTag.Span, "Publiseret " + record.GetDate("date").Value.ToString("dd-MM-yyyy"), "date"); var categorizations = new IdList(record.GetString("categorizations")); if (categorizations.Any()) { RenderCategorizations(writer, categorizations, visibleCategorizations, newsListUrl); } writer.RenderBeginTag(HtmlTextWriterTag.A); var text = record.GetString("summary"); if (text.Length > 150) text = text.Substring(0, 150); writer.RenderFullTag(HtmlTextWriterTag.P, text); writer.RenderEndTag(); // a writer.RenderEndTag(); // div writer.RenderEndTag(); // li.clearfix } if (renderUl) writer.RenderEndTag(); }