// Goal here is to produce a vector of tokens for each cmark_tag.
Goal here is to produce a vector of tokens for each cmark_tag.
Goal here is to produce a vector of tokens for each cmark_tag .
fn cmark_tag_to_wp_tag_start(cmark_tag: &pulldown_cmark::Tag, is_inline: &mut bool) -> Vec<Token> {
    match cmark_tag {
        pulldown_cmark::Tag::Heading(level) => {
            let heading_style = format!("Heading{}", level + 1);
            heading_prequel_tokens(&heading_style)
        }
        pulldown_cmark::Tag::Paragraph => paragraph_prequel_tokens(),
        pulldown_cmark::Tag::Emphasis => {
            *is_inline = true;
            let mut emphasis_start: Vec<Token> = Vec::new();
            emphasis_start.push(run_start_token());
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: start_tag_event("rPr", None),
                xml_reader_event: start_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("rPr"),
                    None,
                ),
                token_text: None,
            });
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: start_tag_event("i", None),
                xml_reader_event: start_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("i"),
                    None,
                ),
                token_text: None,
            });
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: end_tag_event("i"),
                xml_reader_event: end_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("i"),
                ),
                token_text: None,
            });
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: start_tag_event("iCs", None),
                xml_reader_event: start_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("iCs"),
                    None,
                ),
                token_text: None,
            });
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: end_tag_event("iCs"),
                xml_reader_event: end_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("iCs"),
                ),
                token_text: None,
            });
            emphasis_start.push(Token {
                token_type: TokenType::Normal,
                // xml_reader_event: end_tag_event("rPr"),
                xml_reader_event: end_tag_event(
                    &Some(String::from("w")),
                    &Some(String::from(NS_WP_ML)),
                    &String::from("rPr"),
                ),
                token_text: None,
            });
            emphasis_start
        }
        _ => vec![],
    }
}
fn cmark_tag_to_wp_tag_start ( cmark_tag : & pulldown_cmark :: Tag , is_inline : & mut bool ) -> Vec < Token > { match cmark_tag { pulldown_cmark :: Tag :: Heading ( level ) => { let heading_style = format ! ( " " level 1 ) ; heading_prequel_tokens ( & heading_style ) } pulldown_cmark :: Tag :: Paragraph => paragraph_prequel_tokens ( ) , pulldown_cmark :: Tag :: Emphasis => { * is_inline = true ; let mut emphasis_start : Vec < Token > = Vec :: new ( ) ; emphasis_start . push ( run_start_token ( ) ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: start_tag_event("rPr", None), xml_reader_event : start_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , None , ) , token_text : None , } ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: start_tag_event("i", None), xml_reader_event : start_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , None , ) , token_text : None , } ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: end_tag_event("i"), xml_reader_event : end_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , ) , token_text : None , } ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: start_tag_event("iCs", None), xml_reader_event : start_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , None , ) , token_text : None , } ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: end_tag_event("iCs"), xml_reader_event : end_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , ) , token_text : None , } ) ; emphasis_start . push ( Token { token_type : TokenType :: Normal , // xml_reader_event: end_tag_event("rPr"), xml_reader_event : end_tag_event ( & Some ( String :: from ( " " ) ) , & Some ( String :: from ( NS_WP_ML ) ) , & String :: from ( " " ) , ) , token_text : None , } ) ; emphasis_start } _ => vec ! [ ] , } }
Goal here is to produce a vector of tokens for each cmark_tag.
Goal here is to produce a vector of tokens for each cmark_tag .
cmark_tag
&pulldown_cmark::Tag
is_inline
&mut bool