fn expand_bang(&self, bang_name: &str, args: Vec<String>) -> String {
        match bang_name {
            "makeTitle" => {
                let mut template_data =
                    read_to_string(format!("{}{}", self.template_directory, "title.html")).unwrap();

                template_data = template_data.replace(
                    "*+*",
                    args.get(0).unwrap_or(&String::from("Error: Title Missing")),
                );
                template_data =
                    template_data.replace("?*?", args.get(1).unwrap_or(&String::from("")));

                return template_data;
            }
            "archiveEntry" => {
                let mut template_data = read_to_string(format!(
                    "{}{}",
                    self.template_directory, "archiveEntry.html"
                ))
                .unwrap();

                template_data =
                    template_data.replace("?+?", args.get(0).unwrap_or(&String::from("")));

                template_data =
                    template_data.replace("*+*", args.get(1).unwrap_or(&String::from("")));

                template_data =
                    template_data.replace("?d", args.get(2).unwrap_or(&String::from("")));
                return template_data;
            }
            "makeMeta" => {
                let mut template_data =
                    read_to_string(format!("{}{}", self.template_directory, "meta.html")).unwrap();

                while (template_data.contains("param:")) {
                    template_data = template_data
                        .replace("param:title", args.get(0).unwrap_or(&String::from("")));
                    template_data =
                        template_data.replace("param:description", args.get(1).unwrap_or(&String::from("")));
                }
                return template_data;
            }
            _ => String::new(),
        }
    }
// This is where you programatically define bangs.
// I generally use some strange character sequence to identify places where
// you want to fill in bang content
This is where you programatically define bangs.
I generally use some strange character sequence to identify places where
you want to fill in bang content
This is where you programatically define bangs . I generally use some strange character sequence to identify places where you want to fill in bang content
fn expand_bang(&self, bang_name: &str, args: Vec<String>) -> String {
        match bang_name {
            "makeTitle" => {
                let mut template_data =
                    read_to_string(format!("{}{}", self.template_directory, "title.html")).unwrap();
                template_data = template_data.replace(
                    "*+*",
                    args.get(0).unwrap_or(&String::from("Error: Title Missing")),
                );
                template_data =
                    template_data.replace("?*?", args.get(1).unwrap_or(&String::from("")));
                return template_data;
            }
            "archiveEntry" => {
                let mut template_data = read_to_string(format!(
                    "{}{}",
                    self.template_directory, "archiveEntry.html"
                ))
                .unwrap();
                template_data =
                    template_data.replace("?+?", args.get(0).unwrap_or(&String::from("")));
                template_data =
                    template_data.replace("*+*", args.get(1).unwrap_or(&String::from("")));
                template_data =
                    template_data.replace("?d", args.get(2).unwrap_or(&String::from("")));
                return template_data;
            }
            "makeMeta" => {
                let mut template_data =
                    read_to_string(format!("{}{}", self.template_directory, "meta.html")).unwrap();
                while (template_data.contains("param:")) {
                    template_data = template_data
                        .replace("param:title", args.get(0).unwrap_or(&String::from("")));
                    template_data =
                        template_data.replace("param:description", args.get(1).unwrap_or(&String::from("")));
                }
                return template_data;
            }
            _ => String::new(),
        }
    }
fn expand_bang ( & self , bang_name : & str , args : Vec < String > ) -> String { match bang_name { " " => { let mut template_data = read_to_string ( format ! ( " " self template_directory " " ) ) . unwrap ( ) ; template_data = template_data . replace ( " " , args . get ( 0 ) . unwrap_or ( & String :: from ( " " ) ) , ) ; template_data = template_data . replace ( " " , args . get ( 1 ) . unwrap_or ( & String :: from ( " " ) ) ) ; return template_data ; } " " => { let mut template_data = read_to_string ( format ! ( " " self template_directory " " ) ) . unwrap ( ) ; template_data = template_data . replace ( " " , args . get ( 0 ) . unwrap_or ( & String :: from ( " " ) ) ) ; template_data = template_data . replace ( " " , args . get ( 1 ) . unwrap_or ( & String :: from ( " " ) ) ) ; template_data = template_data . replace ( " " , args . get ( 2 ) . unwrap_or ( & String :: from ( " " ) ) ) ; return template_data ; } " " => { let mut template_data = read_to_string ( format ! ( " " self template_directory " " ) ) . unwrap ( ) ; while ( template_data . contains ( " " ) ) { template_data = template_data . replace ( " " , args . get ( 0 ) . unwrap_or ( & String :: from ( " " ) ) ) ; template_data = template_data . replace ( " " , args . get ( 1 ) . unwrap_or ( & String :: from ( " " ) ) ) ; } return template_data ; } _ => String :: new ( ) , } }
This is where you programatically define bangs.
This is where you programatically define bangs .
&self
bang_name
&str
args
Vec<String>