private static void WriteDocumentInHtml(DocumentContent document, List <string> commonSequence, HtmlTextWriter writer) { writer.RenderBeginTag(HtmlTextWriterTag.Td); bool wasCommon = false; var whiteSpacesTokens = new StringBuilder(); foreach (var tokenAndType in document.DevideToCommonAndSpecificTokens(commonSequence)) { var tag = tokenAndType.Item2; var token = tokenAndType.Item1; if (token.Any(char.IsWhiteSpace)) { whiteSpacesTokens.Append(token); continue; } if (wasCommon && tag == TokenType.Common) { WriteWithTag(writer, whiteSpacesTokens.ToString(), TokenType.Common); } else { WriteWithTag(writer, whiteSpacesTokens.ToString(), TokenType.Specific); } WriteWithTag(writer, token, tag); whiteSpacesTokens.Clear(); wasCommon = tag == TokenType.Common; } WriteWithTag(writer, whiteSpacesTokens.ToString(), TokenType.Specific); writer.RenderEndTag(); }
private static void SaveResult(DocumentContent first, DocumentContent second, List <string> commonSequence, HtmlTextWriter writer) { WriteDocumentsNames(first.DocumentName, second.DocumentName, writer); writer.RenderBeginTag(HtmlTextWriterTag.Tr); WriteDocumentInHtml(first, commonSequence, writer); WriteDocumentInHtml(second, commonSequence, writer); writer.RenderEndTag(); }