Esempio n. 1
0
        public virtual ActionResult ValidateMappings(string language, string version, bool all)
        {
            var query = DocumentSession
                        .Query <DocumentationPage>()
                        .Take(int.MaxValue);

            if (all == false)
            {
                query = query.Where(x => x.Version == CurrentVersion);

                if (Enum.TryParse(language, true, out Language parsedLanguage))
                {
                    query = query.Where(x => x.Language == parsedLanguage || x.Language == Language.All);
                }
            }

            var pages = query.ToList();

            var options = new ParserOptions
            {
                PathToDocumentationDirectory = GetDocumentationDirectory(),
                RootUrl   = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~")) + "article/" + CurrentVersion + "/" + CurrentLanguage + "/",
                ImagesUrl = GetImagesUrl(HttpContext, DocumentStore, ArticleType.Documentation)
            };

            var results = new DocumentationValidator(options, CurrentLanguage)
                          .ValidateMappings(pages)
                          .ToList();

            return(View(MVC.Docs.Views.ValidateMappings, results));
        }
Esempio n. 2
0
        public virtual ActionResult Validate(string language, string version, bool all)
        {
            if (DebugHelper.IsDebug() == false)
            {
                return(RedirectToAction(MVC.Docs.ActionNames.Index, MVC.Docs.Name));
            }

            var query = DocumentSession
                        .Query <DocumentationPage>()
                        .Take(1024);

            if (all == false)
            {
                query = query.Where(x => x.Version == CurrentVersion);
            }

            var pages = query.ToList();

            var options = new ParserOptions
            {
                PathToDocumentationDirectory = GetDocumentationDirectory(),
                RootUrl   = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~")) + "article/" + CurrentVersion + "/" + CurrentLanguage + "/",
                ImagesUrl = GetImagesUrl(HttpContext, DocumentStore, ArticleType.Documentation)
            };

            var results = new DocumentationValidator(options, CurrentLanguage)
                          .ValidateLinks(pages)
                          .ToList();

            return(View(MVC.Docs.Views.Validate, results));
        }