You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
767B

  1. use std::env;
  2. use std::path::PathBuf;
  3. use errors::Result;
  4. use site::Site;
  5. use console;
  6. pub fn check(
  7. config_file: &str,
  8. base_path: Option<&str>,
  9. base_url: Option<&str>,
  10. ) -> Result<()> {
  11. let bp = base_path.map(PathBuf::from).unwrap_or(env::current_dir().unwrap());
  12. let mut site = Site::new(bp, config_file)?;
  13. // Force the checking of external links
  14. site.config.check_external_links = true;
  15. // Disable syntax highlighting since the results won't be used
  16. // and this operation can be expensive.
  17. site.config.highlight_code = false;
  18. if let Some(b) = base_url {
  19. site.set_base_url(b.to_string());
  20. }
  21. site.load()?;
  22. console::notify_site_size(&site);
  23. console::warn_about_ignored_pages(&site);
  24. Ok(())
  25. }