コード例 #1
0
ファイル: ProviderArticle.cs プロジェクト: Thirlan/insideword
        protected void SaveBlurb()
        {
            // Clean up the blurb of any unwanted html
            if(_blurbHasChanged || _forceRefresh)
            {
                if (!_entityArticle.BlurbIsAutoGen && !string.IsNullOrEmpty(_entityArticle.Blurb))
                {
                    string blurb = HtmlParser.HtmlFree(_entityArticle.Blurb);
                    blurb = IWStringUtility.TruncateClean(blurb, BlurbSize);
                    _entityArticle.Blurb = HtmlParser.HtmlFree(_entityArticle.Blurb);
                }
                else if (!string.IsNullOrEmpty(RawText))
                {
                    // auto generate blurb
                    HtmlParser htmlDoc = new HtmlParser(RawText);
                    string blurb = htmlDoc.HtmlFree();
                    blurb = IWStringUtility.TruncateClean(blurb, BlurbSize);
                    _entityArticle.Blurb = blurb;
                    _entityArticle.BlurbIsAutoGen = true;

                    // we've saved the changes so clear the changed bool
                    _blurbHasChanged = false;
                }
            }
        }
コード例 #2
0
ファイル: ProviderArticle.cs プロジェクト: Thirlan/insideword
        protected void SaveText()
        {
            if (!string.IsNullOrEmpty(_tempText) || _forceRefresh)
            {
                ArticleText rawArticleText = LoadOrCreateArticleText((int)TextType.raw);
                ArticleText parsedArticleText = LoadOrCreateArticleText((int)TextType.parsed);
                string text = RawText;

                // If the RawText was null then try a recovery by using the parsed text
                text = text ?? parsedArticleText.Text;

                // If the text is still null then set it to blank
                text = text ?? "";

                HtmlParser htmlDoc = new HtmlParser(text);
                rawArticleText.Text = text;
                string injectionFreeHtml = htmlDoc.InjectionHtmlFree();
                parsedArticleText.Text = HtmlParser.EncloseUriLink(injectionFreeHtml);
                //We've saved the text so clear the temp variables
                _tempText = null;
            }
        }
コード例 #3
0
ファイル: HtmlParserTests.cs プロジェクト: Thirlan/insideword
 public void Should_return_absolute_Url_in_domain_specified()
 {
     HtmlParser parser = new HtmlParser("<img src=\"http://www.insideword.com/Content/img/photos/anonymous/cADRobzf1U.png\" />");
     Assert.NotEmpty(parser.GetImageInfos(new List<string>() { "www.insideword.com" }));
 }