pub fn new<P: AsRef<Path>, P2: AsRef<Path>>(path: P, config_file: P2) -> Result<Site> {
        let path = path.as_ref();
        let config_file = config_file.as_ref();
        let mut config = get_config(config_file);
        config.load_extra_syntaxes(path)?;

        if let Some(theme) = config.theme.clone() {
            // Grab data from the extra section of the theme
            config.merge_with_theme(&path.join("themes").join(&theme).join("theme.toml"))?;
        }

        let tera = tpls::load_tera(path, &config)?;

        let content_path = path.join("content");
        let static_path = path.join("static");
        let imageproc =
            imageproc::Processor::new(content_path.clone(), &static_path, &config.base_url);
        let output_path = path.join("public");

        let site = Site {
            base_path: path.to_path_buf(),
            config,
            tera,
            imageproc: Arc::new(Mutex::new(imageproc)),
            live_reload: None,
            output_path,
            content_path,
            static_path,
            taxonomies: Vec::new(),
            permalinks: HashMap::new(),
            include_drafts: false,
            // We will allocate it properly later on
            library: Arc::new(RwLock::new(Library::new(0, 0, false))),
            build_mode: BuildMode::Disk,
        };

        Ok(site)
    }
/// Parse a site at the given path. Defaults to the current dir
/// Passing in a path is used in tests and when --root argument is passed
Parse a site at the given path. Defaults to the current dir
Passing in a path is used in tests and when --root argument is passed
Parse a site at the given path . Defaults to the current dir Passing in a path is used in tests and when -- root argument is passed
pub fn new<P: AsRef<Path>, P2: AsRef<Path>>(path: P, config_file: P2) -> Result<Site> {
        let path = path.as_ref();
        let config_file = config_file.as_ref();
        let mut config = get_config(config_file);
        config.load_extra_syntaxes(path)?;
        if let Some(theme) = config.theme.clone() {
            // Grab data from the extra section of the theme
            config.merge_with_theme(&path.join("themes").join(&theme).join("theme.toml"))?;
        }
        let tera = tpls::load_tera(path, &config)?;
        let content_path = path.join("content");
        let static_path = path.join("static");
        let imageproc =
            imageproc::Processor::new(content_path.clone(), &static_path, &config.base_url);
        let output_path = path.join("public");
        let site = Site {
            base_path: path.to_path_buf(),
            config,
            tera,
            imageproc: Arc::new(Mutex::new(imageproc)),
            live_reload: None,
            output_path,
            content_path,
            static_path,
            taxonomies: Vec::new(),
            permalinks: HashMap::new(),
            include_drafts: false,
            // We will allocate it properly later on
            library: Arc::new(RwLock::new(Library::new(0, 0, false))),
            build_mode: BuildMode::Disk,
        };
        Ok(site)
    }
pub fn new < P : AsRef < Path > , P2 : AsRef < Path > > ( path : P , config_file : P2 ) -> Result < Site > { let path = path . as_ref ( ) ; let config_file = config_file . as_ref ( ) ; let mut config = get_config ( config_file ) ; config . load_extra_syntaxes ( path ) ? ; if let Some ( theme ) = config . theme . clone ( ) { // Grab data from the extra section of the theme config . merge_with_theme ( & path . join ( " " ) . join ( & theme ) . join ( " " ) ) ? ; } let tera = tpls :: load_tera ( path , & config ) ? ; let content_path = path . join ( " " ) ; let static_path = path . join ( " " ) ; let imageproc = imageproc :: Processor :: new ( content_path . clone ( ) , & static_path , & config . base_url ) ; let output_path = path . join ( " " ) ; let site = Site { base_path : path . to_path_buf ( ) , config , tera , imageproc : Arc :: new ( Mutex :: new ( imageproc ) ) , live_reload : None , output_path , content_path , static_path , taxonomies : Vec :: new ( ) , permalinks : HashMap :: new ( ) , include_drafts : false , // We will allocate it properly later on library : Arc :: new ( RwLock :: new ( Library :: new ( 0 , 0 , false ) ) ) , build_mode : BuildMode :: Disk , } ; Ok ( site ) }
Parse a site at the given path.
Parse a site at the given path .
path
P
config_file
P2
path
P
config_file
P2