void RenderVerbatimBlock(VerbatimBlock block, XmlElement container) { XmlElement blockElement = container.OwnerDocument.CreateElement("verbatim-block"); container.AppendChild(blockElement); XmlText blockTextNode = container.OwnerDocument.CreateTextNode(block.Text); blockElement.AppendChild(blockTextNode); container.AppendChild(container.OwnerDocument.CreateTextNode("\n")); }
public virtual void VisitVerbatimBlock(VerbatimBlock verbatimBlock) { }
VerbatimBlock ParseVerbatimBlock() { VerbatimBlock block = new VerbatimBlock(); while (true) { Line line = _classifier.PeekLine(); if (line.Classification != LineClassification.VerbatimBlockLine) { Debug.Assert(block.Lines.Count != 0); return block; } _classifier.ReadLine(); block.Lines.Add(line.Text); } }
static Section GenerateErrorDocument(Exception ex, LineClassifier classifier) { ParseErrorSection topSection = new ParseErrorSection(); Paragraph paragraph = new Paragraph(new FormattedSpan(FormattedSpanKind.Bold, new TextSpan("I can haz fixed?"))); topSection.Blocks.Add(paragraph); LineClassifierContext context = classifier.GetContext(); List<string> lines = new List<string>(); foreach (Pair<int, string> pair in context.AllLines) { lines.Add(string.Format("{0} {1}: {2}", pair.First == context.CurrentLine.First ? ">" : " ", pair.First.ToString().PadLeft(4, ' '), pair.Second)); } VerbatimBlock linesBlock = new VerbatimBlock(); linesBlock.Lines.AddRange(lines); topSection.Blocks.Add(linesBlock); return topSection; }
VerbatimBlock ParseSingleVerbatimLine() { Line verbatimLine = _classifier.ReadLine(); Debug.Assert(verbatimLine.Classification == LineClassification.SingleVerbatimBlockLine); VerbatimBlock block = new VerbatimBlock(); block.Lines.Add(verbatimLine.Text); return block; }