// TODO: Support bitbucket pages and gitlab pages
Support bitbucket pages and gitlab pages
Support bitbucket pages and gitlab pages
fn extract_project_url(text: &str) -> Result<String> {
    let pat = r"\bhttps://([[:alnum:]_-]+)\.github\.io(?:/([[:alnum:]_.-]+))?\b";
    match Regex::new(pat)?.captures(text) {
        None => Err(Error::RepoUrlNotFound(text.to_string())),
        Some(caps) => {
            let user = caps.get(1).unwrap().as_str();
            if let Some(proj) = caps.get(2) {
                Ok(format!("https://github.com/{}/{}", user, proj.as_str()))
            } else {
                Ok(format!("https://github.com/{u}/{u}.github.io", u = user))
            }
        }
    }
}
fn extract_project_url ( text : & str ) -> Result < String > { let pat = r"\bhttps://([[:alnum:]_-]+)\.github\.io(?:/([[:alnum:]_.-]+))?\b" ; match Regex :: new ( pat ) ? . captures ( text ) { None => Err ( Error :: RepoUrlNotFound ( text . to_string ( ) ) ) , Some ( caps ) => { let user = caps . get ( 1 ) . unwrap ( ) . as_str ( ) ; if let Some ( proj ) = caps . get ( 2 ) { Ok ( format ! ( " " user proj as_str ( ) ) ) } else { Ok ( format ! ( " " u user ) ) } } } }
TODO: Support bitbucket pages and gitlab pages
TODO : Support bitbucket pages and gitlab pages
text
&str