Пример #1
0
        private static Snippet CreateSelfClosingElementSnippet()
        {
            var s = new Snippet()
            {
                Title    = "self-closing element",
                Shortcut = ElementShortcut
            };

            s.Description = s.Title;

            Literal nameLiteral = CreateElementNameLiteral();

            s.AddLiteral(nameLiteral);

            Literal attributeLiteral = CreateAttributeLiteral();

            s.AddLiteral(attributeLiteral);

            var w = new SnippetCodeWriter();

            w.Write("<");
            w.WritePlaceholder(nameLiteral.Identifier);
            w.WritePlaceholder(attributeLiteral.Identifier);
            w.Write(" />");
            w.WriteEndPlaceholder();
            s.CodeText = w.ToString();

            s.FilePath = "SelfClosingElement";

            return(s);
        }
Пример #2
0
        private static Snippet CreateCommentSnippet()
        {
            var s = new Snippet()
            {
                Title    = "comment",
                Shortcut = CommentShortcut
            };

            s.Description = s.Title;

            Literal commentLiteral = CreateCommentLiteral();

            s.AddLiteral(commentLiteral);

            var w = new SnippetCodeWriter();

            w.Write("<!-- ");
            w.WritePlaceholder(commentLiteral.Identifier);
            w.Write(" -->");
            w.WriteEndPlaceholder();
            s.CodeText = w.ToString();

            s.FilePath = "Comment";

            return(s);
        }
Пример #3
0
        private static Snippet CreateElementSnippet()
        {
            var s = new Snippet();

            s.Title       = "element";
            s.Shortcut    = ElementShortcut;
            s.Description = s.Title;

            Literal nameLiteral = CreateElementNameLiteral();

            s.AddLiteral(nameLiteral);

            Literal attributeLiteral = CreateAttributeLiteral();

            s.AddLiteral(attributeLiteral);

            Literal contentLiteral = CreateContentLiteral();

            s.AddLiteral(contentLiteral);

            var w = new SnippetCodeWriter();

            w.Write("<");
            w.WritePlaceholder(nameLiteral.Identifier);
            w.WritePlaceholder(attributeLiteral.Identifier);
            w.Write(">");
            w.WritePlaceholder(contentLiteral.Identifier);
            w.Write("</");
            w.WritePlaceholder(NameIdentifier);
            w.Write(">");
            w.WriteEndPlaceholder();
            s.CodeText = w.ToString();

            s.FilePath = "Element";

            return(s);
        }