Beispiel #1
0
 private IEnumerable <string> ProcessXhtml(string textFragment)
 {
     if (textFragment.StartsWith("<html"))
     {
         var crawler = new XhtmlCrawlingHelper();
         crawler.SetPageContext(_currentPage);
         crawler.CrawlXhtml(textFragment);
         foreach (var fragment in crawler.TextParts)
         {
             yield return(fragment);
         }
     }
     else
     {
         yield return(textFragment);
     }
 }
        /// <exclude />
        public virtual IEnumerable <string> GetTextParts(object value)
        {
            var text = value as string;

            if (text == null)
            {
                return(null);
            }

            if (text.StartsWith("<html"))
            {
                var crawler = new XhtmlCrawlingHelper();
                crawler.CrawlXhtml(text);
                return(crawler.TextParts);
            }

            return(new[] { text });
        }
Beispiel #3
0
        private IEnumerable <string> ProcessXhtml(string textFragment)
        {
            if (textFragment.StartsWith("<html"))
            {
                var crawler = new XhtmlCrawlingHelper
                {
                    CrawlFunctionParameters = _currentPage?.DataSourceId.PublicationScope == PublicationScope.Unpublished
                };

                crawler.SetPageContext(_currentPage);
                crawler.CrawlXhtml(textFragment);

                foreach (var fragment in crawler.TextParts)
                {
                    yield return(fragment);
                }
            }
            else
            {
                yield return(textFragment);
            }
        }