Esempio n. 1
0
 public void StartSetextHeader(SetextHeader header)
 {
     Write("setext_header (level={0})", header.Level);
     indent += IndentBy;
 }
Esempio n. 2
0
 public void EndSetextHeader(SetextHeader header)
 {
     indent -= IndentBy;
 }
Esempio n. 3
0
 public void EndSetextHeader(SetextHeader header)
 {
     writer.Write("</h");
     writer.Write(header.Level.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteLine(">");
 }
Esempio n. 4
0
 public void StartSetextHeader(SetextHeader header)
 {
     EnsureNewlineEnding(writer);
     writer.Write("<h");
     writer.Write(header.Level.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.Write(">");
 }
        private static CommonMark.Block BuildBlock(Syntax.Block block)
        {
            CommonMark.Block result = null;
            switch (block.Tag)
            {
                case Syntax.BlockTag.Document:
                    result = new Document(); break;
                case Syntax.BlockTag.BlockQuote:
                    result = new BlockQuote(); break;
                case Syntax.BlockTag.List:
                    if (block.Attributes.ListData.ListType == Syntax.ListType.Ordered)
                        result = new OrderedList()
                        {
                            Start = block.Attributes.ListData.Start
                        };
                    else
                        result = new BulletList();
                    ((List)result).IsTight = block.Attributes.ListData.IsTight;
                    break;
                case Syntax.BlockTag.ListItem:
                    result = new ListItem(); break;
                case Syntax.BlockTag.FencedCode:
                    result = new FencedCode()
                    {
                        Content = block.StringContent,
                        Info = block.Attributes.FencedCodeData.Info
                    }; break;
                case Syntax.BlockTag.IndentedCode:
                    result = new IndentedCode()
                    {
                        Content = block.StringContent
                    }; break;
                case Syntax.BlockTag.HtmlBlock:
                    result = new HtmlCode()
                    {
                        Content = block.StringContent
                    }; break;
                case Syntax.BlockTag.Paragraph:
                    result = new Paragraph(); break;
                case Syntax.BlockTag.AtxHeader:
                    result = new ATXHeader(block.Attributes.HeaderLevel); break;
                case Syntax.BlockTag.SETextHeader:
                    result = new SetextHeader(block.Attributes.HeaderLevel); break;
                case Syntax.BlockTag.HorizontalRuler:
                    result = new HorizontalRule(); break;
                case Syntax.BlockTag.ReferenceDefinition:
                    break;
                default:
                    throw new Exception("Invalid value for BlockTag");
            }
            if (result is ContainerBlock)
            {
                foreach (Syntax.Block b in EnumerateBlocks(block))
                    ((ContainerBlock)result).Append(BuildBlock(b));
            }

            if (result is CommonMark.INodeContainer<CommonMark.Inline>)
                SetInlineContent((CommonMark.INodeContainer<CommonMark.Inline>)result, block.InlineContent);
            return result;
        }
 public void EndSetextHeader(SetextHeader header)
 {
     WritePrefixes();
     if (header.Level == 1)
         WriteLine("===");
     else if (header.Level == 2)
         WriteLine("---");
 }
 public void StartSetextHeader(SetextHeader header)
 {
 }