예제 #1
0
        public string Render(Node node)
        {
            string content = node.Nodes.Any()
                ? nodeListRenderer.Render(node.Nodes)
                : NodeListRenderer.Sanitize(node.Content);

            return($"<em>{content}</em>");
        }
예제 #2
0
        public static string Convert(string wikiText, ConverterConfiguration configuration)
        {
            var nodesRenderer = new NodeListRenderer();

            nodesRenderer.ImagesBaseUrl            = configuration.ImagesBaseUrl;
            nodesRenderer.ImageLeftAlignCssClass   = configuration.ImageLeftAlignCssClass;
            nodesRenderer.ImageRightAlignCssClass  = configuration.ImageRightAlignCssClass;
            nodesRenderer.ImageCenterAlignCssClass = configuration.ImageCenterAlignCssClass;

            return(nodesRenderer.Render(new Parser().Parse(wikiText)));
        }
예제 #3
0
        public string Render(Node node)
        {
            string content = node.Nodes.Any()
                ? nodeListRenderer.Render(node.Nodes)
                : NodeListRenderer.Sanitize(node.Content);

            if (!content.EndsWith("\n"))
            {
                content += "\n";
            }
            return("<p>\n" + content + "</p>\n");
        }
예제 #4
0
        public string Render(Node node)
        {
            if (node.Nodes == null || !node.Nodes.Any())
            {
                return(string.Empty);
            }

            var content      = "<ul>\n";
            var currentLevel = 1;
            var spaceIndent  = string.Empty;

            foreach (ListNode listNode in node.Nodes)
            {
                if (listNode.Level > currentLevel)
                {
                    content     += spaceIndent + " <ul>\n";
                    spaceIndent += " ";
                }
                else if (listNode.Level < currentLevel)
                {
                    spaceIndent = DecrementSpaceIndent(spaceIndent);
                    content    += spaceIndent + " </ul>\n";
                }

                var nodeContent = listNode.Nodes.Any()
                    ? nodeListRenderer.Render(listNode.Nodes)
                    : NodeListRenderer.Sanitize(listNode.Content);

                content     += spaceIndent + " <li>" + nodeContent + "</li>\n";
                currentLevel = listNode.Level > 1 ? listNode.Level : 1;
            }

            var unclosedLevels = spaceIndent.Length;

            if (unclosedLevels > 0)
            {
                for (int i = 0; i < unclosedLevels; i++)
                {
                    content    += spaceIndent + "</ul>\n";
                    spaceIndent = DecrementSpaceIndent(spaceIndent);
                }
            }

            content += "</ul>\n";
            return(content);
        }
예제 #5
0
 internal BoldText(NodeListRenderer nodeListRenderer)
 {
     this.nodeListRenderer = nodeListRenderer;
 }
예제 #6
0
 public string Render(Node node)
 {
     return($"<code>{NodeListRenderer.Sanitize(node.Content)}</code>");
 }
예제 #7
0
 public string Render(Node node)
 {
     return(NodeListRenderer.Sanitize(node.Content));
 }
예제 #8
0
 internal ItalicText(NodeListRenderer nodeListRenderer)
 {
     this.nodeListRenderer = nodeListRenderer;
 }
예제 #9
0
 internal Paragraph(NodeListRenderer nodeListRenderer)
 {
     this.nodeListRenderer = nodeListRenderer;
 }
예제 #10
0
 internal ListBlock(NodeListRenderer nodeListRenderer)
 {
     this.nodeListRenderer = nodeListRenderer;
 }