Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
 public virtual void VisitVerbatimBlock(VerbatimBlock verbatimBlock)
 {
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        VerbatimBlock ParseSingleVerbatimLine()
        {
            Line verbatimLine = _classifier.ReadLine();

            Debug.Assert(verbatimLine.Classification == LineClassification.SingleVerbatimBlockLine);

            VerbatimBlock block = new VerbatimBlock();
            block.Lines.Add(verbatimLine.Text);

            return block;
        }