示例#1
0
        /// <summary>
        /// Get a collection of lines from a HtmlNode
        /// </summary>
        public IList <HtmlLine> GetLines(HtmlNode node, ConvertOptions options)
        {
            HtmlLineCollection lineCollection = new HtmlLineCollection();

            GetLines(node, lineCollection);

            IList <HtmlLine> lines = lineCollection.Lines;

            // remove consequitive empty lines
            HtmlLine previous = null;

            for (int i = lines.Count - 1; i >= 0; i--)
            {
                HtmlLine line = lines[i];

                line.NormalisedValue = NormaliseText(line.Text);

                if (previous != null)
                {
                    if (line.Text == null && previous.Text == null)
                    {
                        lines.RemoveAt(i + 1);
                    }
                }

                previous = line;
            }

            return(lines);
        }
示例#2
0
        /// <summary>
        /// Get a collection of lines from html text
        /// </summary>
        public IList <HtmlLine> GetLines(string html, ConvertOptions options)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);

            return(GetLines(doc.DocumentNode, options));
        }
示例#3
0
        public override string GetFormattedText(ConvertOptions options)
        {
            if (string.IsNullOrEmpty(Text))
            {
                return(null);
            }

            if (options.ImageBrackets)
            {
                return("[Image: " + Text + "]");
            }
            else
            {
                return(Text);
            }
        }
示例#4
0
 public virtual string GetFormattedText(ConvertOptions options)
 {
     return(Text);
 }