Пример #1
0
        private static async Task <string> ParseAsync(IParseManager parseManager, string file, Dictionary <string, string> parameters)
        {
            if (string.IsNullOrEmpty(file))
            {
                return(string.Empty);
            }
            var pageInfo = parseManager.PageInfo;

            var pageParameters = pageInfo.Parameters;

            pageInfo.Parameters = parameters;
            var pageIncludeFile = pageInfo.IncludeFile;

            pageInfo.IncludeFile = file;
            var pageEditableIndex = pageInfo.EditableIndex;

            pageInfo.EditableIndex = 0;

            var content = await parseManager.PathManager.GetIncludeContentAsync(pageInfo.Site, file);

            var contentBuilder = new StringBuilder(content);
            await parseManager.ParseTemplateContentAsync(contentBuilder);

            var parsedContent = contentBuilder.ToString();

            pageInfo.Parameters    = pageParameters;
            pageInfo.IncludeFile   = pageIncludeFile;
            pageInfo.EditableIndex = pageEditableIndex;

            return(parsedContent);
        }