Ejemplo n.º 1
0
        public override string Convert(HtmlNode node)
        {
            string content;

            do
            {
                if (node.ChildNodes.Count == 1 && node.FirstChild.Name == "div")
                {
                    node = node.FirstChild;
                    continue;
                }

                content = TreatChildren(node);
                break;
            } while (true);

            var blockTags = new List <string>
            {
                "pre",
                "p",
                "ol",
                "oi",
                "table"
            };

            // if there is a block child then ignore adding the newlines for div
            if ((node.ChildNodes.Count == 1 && blockTags.Contains(node.FirstChild.Name)))
            {
                return(content);
            }

            return($"{(Td.FirstNodeWithinCell(node) ? "" : Environment.NewLine)}{content}{(Td.LastNodeWithinCell(node) ? "" : Environment.NewLine)}");
        }
Ejemplo n.º 2
0
 private string NewlineAfter(HtmlNode node)
 {
     return(Td.LastNodeWithinCell(node) ? "" : Environment.NewLine);
 }
Ejemplo n.º 3
0
 public override string Convert(HtmlNode node)
 {
     return($"{(Td.FirstNodeWithinCell(node) ? "" : Environment.NewLine)}{TreatChildren(node).Trim()}{(Td.LastNodeWithinCell(node) ? "" : Environment.NewLine)}");
 }