rustyphoenixlecture 1.4.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
****************************************/


///Describe a language, extension, filenames, comments, etc
#[derive(Debug,Clone,Default)]
pub struct PLanguage{
	///Say if the highlighter will display line number
	p_is_line_number: bool,
	///All characters which define a token
	p_token_charset: String,
	///Vector of accepted extensions for highlighting this particular language
	p_vec_extention: Vec<String>,
	///Vector of accepted filenames for highlithing this particular language (CMakeList.txt for cmake, Dockerfile for docker, etc)
	p_vec_filename: Vec<String>,
	///Definition of a single line comment in this language
	p_single_line_comment: String,
	///Beginning of a multi-line comment in this language
	p_multi_line_comment_begin: String,
	///Ending of a multi-line comment in this language
	p_multi_line_comment_end: String,
	///Say if the current parser has an escape char, false otherwise
	p_is_escape_char: bool,
	///Code example for the highlighting
	p_example: String,
}

impl PLanguage{
	///Constructor of a PLanguage
	/// # Parameters
	/// - `is_line_number` : true if the highlighter will display line number
	/// - `token_charset` : charset which contains all characters which composed a token
	pub fn new(is_line_number: bool, token_charset: String) -> Self {
		PLanguage {
			p_is_line_number: is_line_number,
			p_token_charset: token_charset.clone(),
			p_vec_extention: Default::default(),
			p_vec_filename: Default::default(),
			p_single_line_comment: String::from(""),
			p_multi_line_comment_begin: String::from(""),
			p_multi_line_comment_end: String::from(""),
			p_is_escape_char: false,
			p_example: String::from(""),
		}
	}
	///Set the vector of extensions
	/// # Parameters
	/// - `vec_extention` : vector of accepted extensions for highlighting this particular language
	pub fn set_vec_extension(&mut self, vec_extention: &Vec<String>){
		self.p_vec_extention = vec_extention.clone();
	}
	///Set the vector of accepted filenames for this language (CMakeLists.txt for CMake, Dockerfile for Docker, etc)
	/// # Parameters
	/// - `vec_filename` : vector of accepted filenames for highlithing this particular language (CMakeList.txt for cmake, Dockerfile for docker, etc)
	pub fn set_vec_filename(&mut self, vec_filename: &Vec<String>){
		self.p_vec_filename = vec_filename.clone();
	}
	///Set the single line comment
	/// # Parameters
	/// - `single_line_comment` : string which defines a single line comment in the language
	pub fn set_single_line_comment(&mut self, single_line_comment: &String){
		self.p_single_line_comment = single_line_comment.clone();
	}
	///Set the beginning of a multiline comment
	/// # Parameters
	/// - `multi_line_comment_begin` : beginning of a multi-line comment in this language
	pub fn set_multi_line_comment_begin(&mut self, multi_line_comment_begin: &String){
		self.p_multi_line_comment_begin = multi_line_comment_begin.clone();
	}
	///Set the ending of a multiline comment
	/// # Parameters
	/// - `multi_line_comment_end` : ending of a multi-line comment in this language
	pub fn set_multi_line_comment_end(&mut self, multi_line_comment_end: &String){
		self.p_multi_line_comment_end = multi_line_comment_end.clone();
	}
	///Set there is an escape char
	/// # Parameters
	/// - `is_escape_char` : true if there is an escape char
	pub fn set_is_escape_char(&mut self, is_escape_char: bool){
		self.p_is_escape_char = is_escape_char;
	}
	///Set the example of the PLanguage
	/// # Parameters
	/// - `example` : example of the PLanguage
	pub fn set_example(&mut self, example: &String){
		self.p_example = example.clone();
	}
	///Say if the language needs line numbers
	/// # Returns
	/// True if the language needs line numbers, false otherwise
	pub fn get_is_line_number(&self) -> bool{
		self.p_is_line_number
	}
	///Get the token characters set to be used to define a token
	/// # Returns
	/// Token characters set to be used to define a token
	pub fn get_token_charset(&self) -> &String{
		&self.p_token_charset
	}
	///Get the vector of extensions accepted by the language
	/// # Returns
	/// Vector of extensions accepted by the language
	pub fn get_vec_extention(&self) -> &Vec<String>{
		&self.p_vec_extention
	}
	///Get the vector of filenames accepted by the language
	/// # Returns
	/// Vector of filenames accepted by the language (CMakeLists.txt for CMake, Dockerfile for Docker, etc)
	pub fn get_vec_filename(&self) -> &Vec<String>{
		&self.p_vec_filename
	}
	///Get the single line comment of the language
	/// # Returns
	/// Single line comment of the language
	pub fn get_single_line_comment(&self) -> &String{
		&self.p_single_line_comment
	}
	///Get the beginning of the multi lines comment of the language
	/// # Returns
	/// Beginning of the multi lines comment of the language
	pub fn get_multi_line_comment_begin(&self) -> &String{
		&self.p_multi_line_comment_begin
	}
	///Get the ending of the multi lines comment of the language
	/// # Returns
	/// Ending of the multi lines comment of the language
	pub fn get_multi_line_comment_end(&self) -> &String{
		&self.p_multi_line_comment_end
	}
	///Get if there is an escape char
	/// # Returns
	/// True if there is an escape char
	pub fn get_is_escape_char(&self) -> bool{
		self.p_is_escape_char
	}
	///Set the example of the PLanguage
	/// # Returns
	/// Example of the PLanguage
	pub fn get_example(&self) -> &String{
		&self.p_example
	}
}