public string Transform(Topic current, string data)
        {
            var props = data.Split(';');
            var key   = props.First();

            var other = findOther(current, key);

            if (other == null)
            {
                return(string.Empty);
            }

            var url = _urls.ToUrl(current, other);

            var title    = other.Title;
            var template = Template;

            for (int i = 1; i < props.Length; i++)
            {
                if (props[i].StartsWith("title=", StringComparison.InvariantCulture))
                {
                    title = props[i].Split('=').Last().Trim();
                }
                else
                {
                    template = props[i];
                }
            }



            return(template.Replace("{href}", url).Replace("{title}", title));
        }
Exemplo n.º 2
0
        public string Transform(Topic current, string data)
        {
            var url = _urls.ToUrl(current, data);

            return(new HtmlTag("link")
                   .Attr("href", url)
                   .Attr("rel", "stylesheet")
                   .Attr("type", "text/css")
                   .ToString());
        }
        public string Transform(Topic current, string data)
        {
            var ol = new HtmlTag("ol").AddClass("breadcrumb");

            current.Ancestors().Each(x =>
            {
                ol.Add("li/a").Attr("href", _resolver.ToUrl(current, x)).Text(x.Title);
            });

            ol.Add("li").AddClass("active").Text(current.Title);

            return(ol.ToString());
        }
Exemplo n.º 4
0
        private void writeChildNodes(Topic root, Topic parent, HtmlTag tag, IUrlResolver resolver)
        {
            parent.Children.Each(childTopic =>
            {
                var li = tag.Add("li");

                li.Add("a").Attr("href", resolver.ToUrl(root, childTopic)).Text(childTopic.Title);

                if (childTopic.Children.Any())
                {
                    var ul = li.Add("ul");
                    writeChildNodes(root, childTopic, ul, resolver);
                }
            });
        }
        private void writeChildNodes(Topic root, Topic parent, HtmlTag tag, IUrlResolver resolver)
        {
            parent.Children.Each(childTopic =>
            {
                var li = tag.Add("li");

                li.Add("a").Attr("href", resolver.ToUrl(root, childTopic)).Text(childTopic.Title);

                if (childTopic.Children.Any())
                {
                    var ul = li.Add("ul");
                    writeChildNodes(root, childTopic, ul, resolver);
                }
            });
        }
        public string Transform(Topic current, string data)
        {
            var parts = data.Split(';');
            var url   = _urls.ToUrl(current, parts.First());



            var image = new HtmlTag("img").Attr("src", url).Style("max-width", "100%");

            if (parts.Length == 0)
            {
                return(image.ToString());
            }

            var header = new HtmlTag("h5", x =>
            {
                x.Add("strong").Text(parts.Last());
            });

            return(header.ToString() + image.ToString());
        }
Exemplo n.º 7
0
        private string transformFromTopic(Topic current, Topic other, string[] props)
        {
            var url = _urls.ToUrl(current, other);

            var title    = other.Title;
            var template = Template;

            for (int i = 1; i < props.Length; i++)
            {
                if (props[i].StartsWith("title=", StringComparison.Ordinal))
                {
                    title = props[i].Split('=').Last().Trim();
                }
                else
                {
                    template = props[i];
                }
            }

            return(template.Replace("{href}", url).Replace("{title}", title));
        }
Exemplo n.º 8
0
        public string Transform(Topic current, string data)
        {
            var url = _resolver.ToUrl(current, data);

            return(url);
        }
Exemplo n.º 9
0
        public string Transform(Topic current, string data)
        {
            var url = _urls.ToUrl(current, data);

            return(new HtmlTag("script").Attr("type", "text/javascript").Attr("src", url).ToString());
        }