Esempio n. 1
0
 protected override void Write(NormalizeRenderer renderer, LinkReferenceDefinitionGroup obj)
 {
     renderer.EnsureLine();
     renderer.WriteChildren(obj);
     renderer.FinishBlock(false);
 }
Esempio n. 2
0
        protected override void Write(NormalizeRenderer renderer, ListBlock listBlock)
        {
            renderer.EnsureLine();
            var compact = renderer.CompactParagraph;

            renderer.CompactParagraph = !listBlock.IsLoose;
            if (listBlock.IsOrdered)
            {
                int index = 0;
                if (listBlock.OrderedStart != null)
                {
                    switch (listBlock.BulletType)
                    {
                    case '1':
                        int.TryParse(listBlock.OrderedStart, out index);
                        break;
                    }
                }
                for (var i = 0; i < listBlock.Count; i++)
                {
                    var item     = listBlock[i];
                    var listItem = (ListItemBlock)item;
                    renderer.EnsureLine();

                    renderer.Write(index.ToString(CultureInfo.InvariantCulture));
                    renderer.Write(listBlock.OrderedDelimiter);
                    renderer.Write(' ');
                    renderer.PushIndent(new string(' ', IntLog10Fast(index) + 3));
                    renderer.WriteChildren(listItem);
                    renderer.PopIndent();
                    switch (listBlock.BulletType)
                    {
                    case '1':
                        index++;
                        break;
                    }
                    if (i + 1 < listBlock.Count && listBlock.IsLoose)
                    {
                        renderer.EnsureLine();
                        renderer.WriteLine();
                    }
                }
            }
            else
            {
                for (var i = 0; i < listBlock.Count; i++)
                {
                    var item     = listBlock[i];
                    var listItem = (ListItemBlock)item;
                    renderer.EnsureLine();
                    renderer.Write(renderer.Options.ListItemCharacter ?? listBlock.BulletType);
                    renderer.Write(' ');
                    renderer.PushIndent("  ");
                    renderer.WriteChildren(listItem);
                    renderer.PopIndent();
                    if (i + 1 < listBlock.Count && listBlock.IsLoose)
                    {
                        renderer.EnsureLine();
                        renderer.WriteLine();
                    }
                }
            }
            renderer.CompactParagraph = compact;

            renderer.FinishBlock(true);
        }