示例#1
0
        private StringBuffer RenderAzureIncludeToken(AzureIncludeBasicToken token, IMarkdownContext context)
        {
            StringBuffer content = StringBuffer.Empty;
            object       path;

            if (!context.Variables.TryGetValue("path", out path))
            {
                Logger.LogWarning($"Can't get path for the file that ref azure include file {token.Src}. Raw: {token.RawMarkdown}");
                return(null);
            }

            if (PathUtility.IsRelativePath(token.Src))
            {
                var includeFilePath = Path.Combine(Path.GetDirectoryName(path.ToString()), token.Src);
                if (!File.Exists(includeFilePath))
                {
                    Logger.LogWarning($"Can't get include file in path {includeFilePath}. Raw: {token.RawMarkdown}");
                    return(null);
                }

                // TODO: We should handle Azure syntax in the include file. Such as Azure Selector
                content += File.ReadAllText(includeFilePath);
            }
            else
            {
                Logger.LogWarning($"include path {token.Src} is not a relative path, can't expand it");
                return(null);
            }
            return(content);
        }
示例#2
0
        private StringBuffer RenderAzureIncludeToken(AzureIncludeBasicToken token, IMarkdownContext context)
        {
            StringBuffer content = StringBuffer.Empty;
            object path;
            if (!context.Variables.TryGetValue("path", out path))
            {
                Logger.LogWarning($"Can't get path for the file that ref azure include file {token.Src}. Raw: {token.RawMarkdown}");
                return null;
            }

            if (PathUtility.IsRelativePath(token.Src))
            {
                var includeFilePath = Path.Combine(Path.GetDirectoryName(path.ToString()), token.Src);
                if (!File.Exists(includeFilePath))
                {
                    Logger.LogWarning($"Can't get include file in path {includeFilePath}. Raw: {token.RawMarkdown}");
                    return null;
                }

                // TODO: We should handle Azure syntax in the include file. Such as Azure Selector
                content += File.ReadAllText(includeFilePath);
            }
            else
            {
                Logger.LogWarning($"include path {token.Src} is not a relative path, can't expand it");
                return null;
            }
            return content;
        }
示例#3
0
 private StringBuffer RenderAzureIncludeToken(IMarkdownRenderer render, AzureIncludeBasicToken token, IMarkdownContext context)
 {
     StringBuffer content = StringBuffer.Empty;
     foreach(var t in token.Tokens)
     {
         content += render.Render(t);
     }
     return content;
 }
示例#4
0
        private StringBuffer RenderAzureIncludeToken(IMarkdownRenderer render, AzureIncludeBasicToken token, IMarkdownContext context)
        {
            StringBuffer content = StringBuffer.Empty;

            foreach (var t in token.Tokens)
            {
                content += render.Render(t);
            }
            return(content);
        }