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

use crate::phighlighter::PLocation;
use crate::pcontent::pabstractcontent::PAbstractLectureBackend;

///String backend for the lecture used mainly for unit testing, to ease string comparison without openning a file with all the trouble that come with it
pub struct PStrBackend{
	///Content of the backend
	body: String,
}

impl PStrBackend{
	///Constructor of the PStrBackend
	pub fn new() -> Self{
		PStrBackend {
			body: String::from("")
		}
	}
	///Get the content of the PStrBackend
	/// # Returns
	/// Content of the PStrBackend
	pub fn get_body(&self) -> &String{
		&self.body
	}
}

impl PAbstractLectureBackend for PStrBackend {
	///Create a new file
	/// # Parameters
	/// - `_output_filename` : name of the file to write
	/// - `_title` : title of the section
	/// - `_location` : location of current source file where this section was defined
	/// - `_prev_page` : previous page to visit
	/// - `_next_page` : next page to visit
	fn create_file(&mut self, _output_filename: &String, _title: &String,
		_location: &PLocation,
		_prev_page: &String, _next_page: &String)
	{
		//Let's close the previous file is there was one
		self.close();
	}
	///Write text in the current file
	/// # Parameters
	/// - `text` : text to write in the current file
	fn write(&mut self, text: &String){
		self.body += &text;
	}
	///Write a formula in html
	/// # Parameters
	/// - `formula` : formula to write in html
	/// # Errors
	/// This function will panic if there is a problem during the formula generation
	fn write_formula(&mut self, formula: &String){
		self.body += &formula;
	}
	///Close the current file
	fn close(&mut self){
		self.body = String::from("");
	}
}