public override void Process(TagHelpers.TagHelperContext context, TagHelpers.TagHelperOutput output)
        {
            var name    = Octicons.SymbolName(Symbol);
            var octicon = _octicons.Symbol(Symbol);

            //var symbolStartTag = $"<symbol viewBox=\"0 0 {octicon.Width} {octicon.Height}\" id=\"{name}\">";
            //var symbolEndTag = "</symbol>";

            output.TagName = "symbol";
            output.Attributes.Add("id", name);
            output.Attributes.Add("viewBox", $"0 0 {octicon.Width} {octicon.Height}");
            output.Content.SetHtmlContent(octicon.Path);
        }
Пример #2
0
        private string Classes(TagHelpers.TagHelperContext context)
        {
            var symbolName = Octicons.SymbolName(Symbol);
            var classes    = $"octicon octicon-{symbolName}";

            TagHelpers.TagHelperAttribute classAttribute;
            bool foundClass = context.AllAttributes.TryGetAttribute("class", out classAttribute);

            if (foundClass)
            {
                classes = $"{classes} {classAttribute.Value}";
            }

            return(classes);
        }
Пример #3
0
 private string Svg(bool useSprite) =>
 useSprite ? $"<use xlink:href=\"#{Octicons.SymbolName(Symbol)}\" />" : _octicons.Symbol(Symbol).Path;
Пример #4
0
 /// <summary>
 /// Use this method to get an <see cref="Octicon" /> symbol.
 /// </summary>
 /// <param name="name">The octicon name</param>
 /// <returns></returns>
 public Octicon Symbol(OcticonSymbol symbol) => _octiconSymbols[Octicons.SymbolName(symbol)];