コード例 #1
0
ファイル: PostTextTagHelper.cs プロジェクト: zrinkop/Bazirano
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";

            string greenText     = PostTextHelper.GetGreenText(Text);
            string textWithLinks = PostTextHelper.GeneratePostAnchorLinks(greenText);

            output.Content.SetHtmlContent(textWithLinks);
        }
コード例 #2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            string shortenedText = "";

            if (Text.Length > 100)
            {
                shortenedText = Text.Substring(0, 100);

                if (shortenedText.Last() == ' ')
                {
                    shortenedText.Remove(shortenedText.Last());
                }

                shortenedText += "...";
            }

            string textToDisplay = Text.Length > 100 ? shortenedText : Text;

            string greenText = PostTextHelper.GetGreenText(textToDisplay, true);

            output.Content.SetHtmlContent(greenText);
        }