pub fn generate_readme<T: Read>(
    project_root: &Path,
    source: &mut T,
    template: Option<&mut T>,
    add_title: bool,
    add_badges: bool,
    add_license: bool,
    indent_headings: bool,
) -> Result<String, String> {
    let lines = extract::extract_docs(source).map_err(|e| format!("{}", e))?;

    let readme = process::process_docs(lines, indent_headings).join("\n");

    // get template from file
    let template = if let Some(template) = template {
        Some(get_template_string(template)?)
    } else {
        None
    };

    // get manifest from Cargo.toml
    let cargo = config::get_manifest(project_root)?;

    template::render(template, readme, &cargo, add_title, add_badges, add_license)
}
/// Generates readme data from `source` file
///
/// Optionally, a template can be used to render the output
Generates readme data from `source` file
Optionally, a template can be used to render the output
Generates readme data from ` source ` file Optionally a template can be used to render the output
pub fn generate_readme<T: Read>(
    project_root: &Path,
    source: &mut T,
    template: Option<&mut T>,
    add_title: bool,
    add_badges: bool,
    add_license: bool,
    indent_headings: bool,
) -> Result<String, String> {
    let lines = extract::extract_docs(source).map_err(|e| format!("{}", e))?;
    let readme = process::process_docs(lines, indent_headings).join("\n");
    // get template from file
    let template = if let Some(template) = template {
        Some(get_template_string(template)?)
    } else {
        None
    };
    // get manifest from Cargo.toml
    let cargo = config::get_manifest(project_root)?;
    template::render(template, readme, &cargo, add_title, add_badges, add_license)
}
pub fn generate_readme < T : Read > ( project_root : & Path , source : & mut T , template : Option < & mut T > , add_title : bool , add_badges : bool , add_license : bool , indent_headings : bool , ) -> Result < String , String > { let lines = extract :: extract_docs ( source ) . map_err ( | e | format ! ( " " e ) ) ? ; let readme = process :: process_docs ( lines , indent_headings ) . join ( " \n " ) ; // get template from file let template = if let Some ( template ) = template { Some ( get_template_string ( template ) ? ) } else { None } ; // get manifest from Cargo.toml let cargo = config :: get_manifest ( project_root ) ? ; template :: render ( template , readme , & cargo , add_title , add_badges , add_license ) }
Generates readme data from `source` file
Optionally, a template can be used to render the output
Generates readme data from ` source ` file Optionally a template can be used to render the output
project_root
&Path
source
&mut T
template
Option<&mut T>
add_title
bool
add_badges
bool
add_license
bool
indent_headings
bool