rustyphoenixlecture 1.1.0

This project aims to provide a simple a powerfull lecture compilation to generate html web sites
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/

///Save a label in html
/// # Parameters
/// - `label` : label of the PContent
/// - `option_id` : optionnal id of the current PContent to be referenced
/// # Returns
/// Corresponding html, or empty string is there is no label
pub fn phoenix_html_label(label: &String, option_id: Option<usize>) -> String{
	if label.is_empty() {
		return String::from("");
	}
	let extra_id: String = match option_id {
		Some(id) => String::from(format!("<b>({})</b>", id)),
		None => String::from("")
	};
	let mut body = String::from(r#"<span class="redirectIcon"><a href="redirection.html?label="#);
	body += &label;
	body += &String::from(r#"">"#);
	body += &extra_id;
	body += &String::from(r#"<img src="book/images/iconlink_32.png"></a></span>"#);
	return body;
}

#[cfg(test)]
mod tests{
	use super::*;
	
	///Test the phoenix_html_label
	#[test]
	fn test_phoenix_html_label(){
		assert_eq!(phoenix_html_label(&String::from("secFirstPerformanceTestTimerH"), None), String::from(r#"<span class="redirectIcon"><a href="redirection.html?label=secFirstPerformanceTestTimerH"><img src="book/images/iconlink_32.png"></a></span>"#));
		
		assert_eq!(phoenix_html_label(&String::from("secFirstPerformanceTestTimerH"), Some(42)), String::from(r#"<span class="redirectIcon"><a href="redirection.html?label=secFirstPerformanceTestTimerH"><b>(42)</b><img src="book/images/iconlink_32.png"></a></span>"#));
	}
}