public ParseResult Run(MetadataModel yaml, ResolverContext context) { var index = yaml.Indexer; TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (member, parent) => { // get all the possible places where link is possible if (member.Syntax != null && member.Syntax.Content != null) { SyntaxLanguage[] keys = new SyntaxLanguage[member.Syntax.Content.Count]; member.Syntax.Content.Keys.CopyTo(keys, 0); foreach (var key in keys) { member.Syntax.Content[key] = NormalizeLines(member.Syntax.Content[key]); } } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { yaml.TocYamlViewModel = yaml.TocYamlViewModel.ShrinkToSimpleTocWithNamespaceNotEmpty(); // Comparing to toc files, yaml files are all in api folder TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (current, parent) => { if (current.Type != MemberType.Toc) { if (!string.IsNullOrEmpty(current.Href)) { current.Href = context.ApiFolder.ForwardSlashCombine(current.Href); } } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid || (s.Type != MemberType.Namespace && s.Type != MemberType.Toc)) { return(null); } else { return(s.Items); } }, (member, parent) => { if (member.Type != MemberType.Toc) { yaml.Members.Add(member); } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (current, parent) => { if (current.Type != MemberType.Toc) { if (current.Type.IsPageLevel()) { current.Href = current.Name + Constants.YamlExtension; } else { current.Href = parent.Href; } } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (current, parent) => { if (current.Inheritance != null && current.Inheritance.Count > 0) { current.Inheritance.ForEach(s => { if (!s.IsExternalPath) { s.Href = ResolveInternalLink(yaml.Indexer, s.Name); } }); } if (current.Syntax != null && current.Syntax.Parameters != null) { current.Syntax.Parameters.ForEach(s => { Debug.Assert(s.Type != null); if (s.Type != null && !s.Type.IsExternalPath) { s.Type.Href = ResolveInternalLink(yaml.Indexer, s.Type.Name); } }); } if (current.Syntax != null && current.Syntax.Return != null && current.Syntax.Return.Type != null) { current.Syntax.Return.Type.Href = ResolveInternalLink(yaml.Indexer, current.Syntax.Return.Type.Name); } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { var index = yaml.Indexer; TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (member, parent) => { // get all the possible places where link is possible member.Remarks = ResolveText(index, member.Remarks); member.Summary = ResolveText(index, member.Summary); if (member.Syntax != null && member.Syntax.Parameters != null) { member.Syntax.Parameters.ForEach(s => { s.Description = ResolveText(index, s.Description); }); } if (member.Syntax != null && member.Syntax.Return != null) { member.Syntax.Return.Description = ResolveText(index, member.Syntax.Return.Description); } // resolve parameter's Type return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }
public ParseResult Run(MetadataModel yaml, ResolverContext context) { TreeIterator.PreorderAsync <MetadataItem>(yaml.TocYamlViewModel, null, (s) => { if (s.IsInvalid) { return(null); } else { return(s.Items); } }, (member, parent) => { if (member.Type != MemberType.Toc) { MetadataItem item; if (yaml.Indexer.TryGetValue(member.Name, out item)) { ParseResult.WriteToConsole(ResultLevel.Error, "{0} already exists in {1}, the duplicate one {2} will be ignored", member.Name, item.Href, member.Href); } else { yaml.Indexer.Add( member.Name, new MetadataItem { Name = member.Name, Href = context.ApiFolder.ForwardSlashCombine(member.Href) }); } } return(Task.FromResult(true)); } ).Wait(); return(new ParseResult(ResultLevel.Success)); }