Beispiel #1
0
        private static ParseResult TryGenerateMarkdownIndexFileCore(string inputApiIndexFilePath, List <string> mdFiles, string outputMardownMapFileFolder, string outputApiMapFileFolder, string outputReferenceFolder)
        {
            // Generate markdown index
            if (mdFiles != null && mdFiles.Count > 0)
            {
                string markdownIndexOutputFolder = outputMardownMapFileFolder;
                string apiIndexOutputFolder      = outputApiMapFileFolder;
                string referenceOutputFolder     = outputReferenceFolder;
                foreach (var mdFile in mdFiles.Distinct())
                {
                    IndexerContext context = new IndexerContext
                    {
                        ApiIndexFilePath            = inputApiIndexFilePath,
                        MarkdownFilePath            = mdFile,
                        MarkdownMapFileOutputFolder = markdownIndexOutputFolder,
                        ApiMapFileOutputFolder      = apiIndexOutputFolder,
                        ReferenceOutputFolder       = referenceOutputFolder,
                    };
                    var result = MarkdownIndexer.MarkdownIndexer.Exec(context);
                    result.WriteToConsole();
                }
            }
            else
            {
                return(new ParseResult(ResultLevel.Info, "No Markdown file is included."));
            }

            return(new ParseResult(ResultLevel.Success));
        }
Beispiel #2
0
 public Initializer(
     IContext bagetContext,
     IndexerContext indexerContext,
     SearchServiceClient searchClient,
     ILogger <Initializer> logger)
 {
     _bagetContext   = bagetContext ?? throw new ArgumentNullException(nameof(bagetContext));
     _indexerContext = indexerContext ?? throw new ArgumentNullException(nameof(indexerContext));
     _searchClient   = searchClient ?? throw new ArgumentNullException(nameof(searchClient));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public void TestResolveYamlHeader()
        {
            MapFileItemViewModel item    = new MapFileItemViewModel();
            IndexerContext       context = new IndexerContext();

            context.ExternalApiIndex = new Dictionary <string, MetadataItem>
            {
                { "api1", new MetadataItem()
                  {
                      Name = "api1", Href = "api1.yml"
                  } },
                { "api2", new MetadataItem()
                  {
                      Name = "api2", Href = "api2.yml"
                  } }
            };
            ResolveYamlHeader resolver = new ResolveYamlHeader();
            var result = resolver.Run(item, context);

            Assert.AreEqual(result.ResultLevel, ResultLevel.Success);
        }
 public ParseResult Run(MapFileItemViewModel item, IndexerContext context)
 {
     return(new ParseResult(ResultLevel.Success));
 }
Beispiel #5
0
 public Importer(IndexerContext context, BatchIndexer indexer, ILogger <Importer> logger)
 {
     _context = context ?? throw new ArgumentException(nameof(context));
     _indexer = indexer ?? throw new ArgumentNullException(nameof(indexer));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }