Example #1
0
		/// <summary>
		/// Writes out one line and comments, if any.
		/// </summary>
		/// <param name="cell"> The table cell to use. </param>
		/// <param name="line"> Current line. </param>
		/// <param name="comments"> Comments. </param>
		/// <param name="commentIndex"> [In/Out] Current index into comments array. </param>
		private IEnumerable<Control> EncodeLineTextAndComments(
			ILineEncoder encoder,
			string prefix,
			LineAndComments line)
		{
			StringBuilder lineHtml = new StringBuilder(encoder.EncodeLine(line.LineText, int.MaxValue, TabValue));

			StringBuilder commentsHtml = new StringBuilder();
			if (line.Comments != null)
			{
				foreach (var comment in line.Comments)
					AddCommentToCell(commentsHtml, comment, prefix);
			}

			return new Control[2]
			{
				new Literal() { Text = "<pre class=\"Code\">" + lineHtml.ToString() + "</pre>" },
				new Literal() { Text = commentsHtml.ToString() }
			};
		}
Example #2
0
		/// <summary>
		/// Writes out one line and comments, if any.
		/// </summary>
		/// <param name="cell"> The table cell to use. </param>
		/// <param name="line"> Current line. </param>
		/// <param name="comments"> Comments. </param>
		/// <param name="commentIndex"> [In/Out] Current index into comments array. </param>
		private IEnumerable<Control> EncodeLineTextAndComments(
			ILineEncoder encoder,
			string prefix,
			int lineNumber,
			string lineText,
			AbstractedComment[] comments,
			ref int commentIndex)
		{
			StringBuilder lineHtml = new StringBuilder(encoder.EncodeLine(lineText, int.MaxValue, TabValue));

			StringBuilder commentsHtml = new StringBuilder();
			while (commentIndex < comments.Length && comments[commentIndex].Line == lineNumber)
			{
				AddCommentToCell(commentsHtml, comments[commentIndex], prefix);
				++commentIndex;
			}

			return new Control[2]
			{
				new Literal() { Text = "<pre class=\"Code\">" + lineHtml.ToString() + "</pre>" },
				new Literal() { Text = commentsHtml.ToString() }
			};
		}