Example #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);

                Language parsedLanguage;

                if (Enum.TryParse(language, true, out 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()
            };

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

            return View(MVC.Docs.Views.ValidateMappings, results);
        }
Example #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()
                        };

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

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