Exemple #1
0
        public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
        {
            var comment = trivia.ToString();

            if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia)
            {
                if (!comment.StartsWith("/*uncomment"))
                {
                    bool shouldCreateTextBlock = trivia.GetParents().Count(p => IsNestingParent(p, trivia)) <= 1;
                    if (shouldCreateTextBlock)
                    {
                        Blocks.Add(ExtractMarkDownFromComment(trivia));
                    }
                }
            }
            else if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia)
            {
                if (comment.StartsWith("//#"))
                {
                    var parts = comment.Split(new[] { ' ' }, 2);
                    if (parts[0] == "//#video")
                    {
                        EmbedVideo(parts[1]);
                    }
                    if (parts[0] == "//#include")
                    {
                        EmbedCode(parts[1]);
                    }
                    if (parts[0] == "//#para")
                    {
                        EmbedPara(parts[1]);
                    }
                    if (parts[0] == "//#gallery")
                    {
                        EmbedGallery(parts[1]);
                    }
                }
            }
            return(base.VisitTrivia(trivia));
        }
Exemple #2
0
		public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
		{
			var comment = trivia.ToString();
			if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia)
			{
				if (!comment.StartsWith("/*uncomment"))
				{
					bool shouldCreateTextBlock = trivia.GetParents().Count(p => IsNestingParent(p, trivia)) <= 1;
					if (shouldCreateTextBlock)
						Blocks.Add(ExtractMarkDownFromComment(trivia));
				}
			}
			else if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia)
			{
				if (comment.StartsWith("//#"))
				{
					var parts = comment.Split(new[] { ' ' }, 2);
					if (parts[0] == "//#video") EmbedVideo(parts[1]);
                    if (parts[0] == "//#include") EmbedCode(parts[1]);
                    if (parts[0] == "//#para") EmbedPara(parts[1]);
                    if (parts[0] == "//#gallery") EmbedGallery(parts[1]);
				}
			}
			return base.VisitTrivia(trivia);
		}