public override string Generate(IShortcodeContext context)
        {
            if (!string.IsNullOrEmpty(Content))
            {
                return(string.Format("Hello {0}, {1} ({2})", Name, Age, Content));
            }

            return(string.Format("Hello {0}, {1}", Name, Age));
        }
Exemple #2
0
        public override string Generate(IShortcodeContext context)
        {
            var name = Attributes["name"];

            if (IsSet("age"))
            {
                var age = Attributes["age"];
                return(string.Format("Dummy Medium, and you are {0}, age {1}.", name, age));
            }

            return(string.Format("Dummy Medium, and you are {0}.", name));
        }
        public override string Generate(IShortcodeContext context)
        {
            TagBuilder html = new TagBuilder("iframe");

            html.MergeAttribute("width", Width);
            html.MergeAttribute("height", Height);
            html.MergeAttribute("type", "text/html");
            html.MergeAttribute("frameborder", "0");
            html.MergeAttribute("src", string.Format(YOUTUBE_URL_FORMAT, Id, HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)));

            return(html.ToString(TagRenderMode.Normal) + Content);
        }
Exemple #4
0
        public override string Generate(IShortcodeContext context)
        {
            TagBuilder html = new TagBuilder("iframe");

            html.MergeAttribute("width", Width);
            html.MergeAttribute("height", Height);
            html.MergeAttribute("type", "text/html");
            html.MergeAttribute("frameborder", "0");
            html.MergeAttribute("src", string.Format(YOUTUBE_URL_FORMAT, Id, HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)));

            return html.ToString(TagRenderMode.Normal) + Content;
        }
Exemple #5
0
        public override string Generate(IShortcodeContext context)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("<ul class=\"{0}\">", ListCssClass);

            var contentRepository = EncelApplication.Configuration.ContentRepositoryFactory.Create();
            var currentContent = HttpContext.Current.Request.RequestContext.GetCurrentContent();
            var contentUri = Root != null ? ContentUri.Parse(Root) : currentContent.ContentUri;

            IEnumerable<IContentData> children;

            if (Descendants)
            {
                children = contentRepository.GetDescendants(contentUri);
            }
            else
            {
                children = contentRepository.GetChildren(contentUri);
            }

            children = children.OrderBy(m => m.Published).AsEnumerable();

            if (IsSet("OfType"))
            {
                children = children.Where(m => m.Layout != null && m.Layout.Equals(OfType, StringComparison.InvariantCultureIgnoreCase));
            }

            if (Take.HasValue)
            {
                children = children.Take(Take.GetValueOrDefault());
            }

            foreach (var contentData in children)
            {
                sb.AppendFormat("<li class=\"{2}\"><a href=\"{0}\">{1}</a></li>", contentData.ContentUri.AbsolutePath, contentData.Title ?? contentData.Slug, ListItemCssClass);
            }

            sb.Append("</ul>");

            return sb.ToString();
        }
Exemple #6
0
        public override string Generate(IShortcodeContext context)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("<ul class=\"{0}\">", ListCssClass);

            var contentRepository = EncelApplication.Configuration.ContentRepositoryFactory.Create();
            var currentContent    = HttpContext.Current.Request.RequestContext.GetCurrentContent();
            var contentUri        = Root != null?ContentUri.Parse(Root) : currentContent.ContentUri;

            IEnumerable <IContentData> children;

            if (Descendants)
            {
                children = contentRepository.GetDescendants(contentUri);
            }
            else
            {
                children = contentRepository.GetChildren(contentUri);
            }

            children = children.OrderBy(m => m.Published).AsEnumerable();

            if (IsSet("OfType"))
            {
                children = children.Where(m => m.Layout != null && m.Layout.Equals(OfType, StringComparison.InvariantCultureIgnoreCase));
            }

            if (Take.HasValue)
            {
                children = children.Take(Take.GetValueOrDefault());
            }

            foreach (var contentData in children)
            {
                sb.AppendFormat("<li class=\"{2}\"><a href=\"{0}\">{1}</a></li>", contentData.ContentUri.AbsolutePath, contentData.Title ?? contentData.Slug, ListItemCssClass);
            }

            sb.Append("</ul>");

            return(sb.ToString());
        }
Exemple #7
0
        public override string Generate(IShortcodeContext context)
        {
            var childShortcodes = context.Parser.GetShortcodes(Content);

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

            var stringBuilder = new StringBuilder();

            stringBuilder.Append("<ul>");

            foreach (var shortcode in childShortcodes)
            {
                stringBuilder.Append(string.Format("<li>{0}</li>", shortcode.Generate(context)));
            }

            stringBuilder.Append("</ul>");

            return(stringBuilder.ToString());
        }
Exemple #8
0
 public abstract string Generate(IShortcodeContext context);
 public override string Generate(IShortcodeContext context)
 {
     return("Item" + Content);
 }
 public override string Generate(IShortcodeContext context)
 {
     return(string.Format("Dummy Hard, and you are {0}, age {1}.", Name, Age));
 }
Exemple #11
0
 public override string Generate(IShortcodeContext context)
 {
     return("From Dummy Small");
 }
Exemple #12
0
 public override string Generate(IShortcodeContext context)
 {
     return(null);
 }