예제 #1
0
            public async Task CommitAsync()
            {
                _writer.EndTransaction(this);
                await _writer.WriteAsync("|");

                await _writer.WriteAsync(string.Join("|", _headers.Select(h => HtmlNewlines(TrimNewlines(h)))));

                await _writer.WriteLineAsync("|");

                await _writer.WriteAsync("|");

                await _writer.WriteAsync(string.Join("|", Enumerable.Range(0, _headers.Length).Select(n => "---")));

                await _writer.WriteLineAsync("|");

                var rows = (int)Math.Ceiling(_cells.Count / 2.0);

                for (var row = 0; row < rows; row++)
                {
                    var range = _cells.Skip(row * 2).Take(_headers.Length);
                    await _writer.WriteAsync("|");

                    await _writer.WriteAsync(string.Join("|", range));

                    await _writer.WriteLineAsync("|");
                }

                await _writer.WriteLineAsync();
            }
예제 #2
0
            public async Task CommitAsync()
            {
                _writer.EndTransaction(this);
                var content = SoftNewlines(TrimNewlines(_buffer.ToString()));
                await _writer.WriteLineAsync(content);

                await _writer.WriteLineAsync();
            }