Reduce compiler warnings
This commit is contained in:
parent
714e944d93
commit
19aaf6fdcd
5 changed files with 8 additions and 13 deletions
|
@ -5,7 +5,7 @@ use config::Config;
|
||||||
|
|
||||||
|
|
||||||
pub fn build_input(config: Config, input: String) -> Result<String, String> {
|
pub fn build_input(config: Config, input: String) -> Result<String, String> {
|
||||||
let html = try!(pandoc::render(config.clone(), input));
|
let html = try!(pandoc::render(input));
|
||||||
let rendered = try!(render::render(config.clone(), html));
|
let rendered = try!(render::render(config.clone(), html));
|
||||||
return Ok(rendered);
|
return Ok(rendered);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use config::Config;
|
|
||||||
use pandoc::{self, Pandoc, PandocOutput, PandocError};
|
use pandoc::{self, Pandoc, PandocOutput, PandocError};
|
||||||
use std::env::{current_dir, current_exe};
|
use std::env::current_exe;
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
fn execute_pandoc(config: Config, input: String) -> Result<PandocOutput, PandocError> {
|
|
||||||
|
fn execute_pandoc(input: String) -> Result<PandocOutput, PandocError> {
|
||||||
let mut renderer = Pandoc::new();
|
let mut renderer = Pandoc::new();
|
||||||
renderer.set_output_format(pandoc::OutputFormat::Html, vec![]);
|
renderer.set_output_format(pandoc::OutputFormat::Html, vec![]);
|
||||||
renderer.set_input_format(pandoc::InputFormat::Markdown, vec![]);
|
renderer.set_input_format(pandoc::InputFormat::Markdown, vec![]);
|
||||||
|
@ -17,8 +16,8 @@ fn execute_pandoc(config: Config, input: String) -> Result<PandocOutput, PandocE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn render(config: Config, input: String) -> Result<String, String> {
|
pub fn render(input: String) -> Result<String, String> {
|
||||||
let output = execute_pandoc(config, input);
|
let output = execute_pandoc(input);
|
||||||
if output.is_err() {
|
if output.is_err() {
|
||||||
return Err(output.err().unwrap().description().into());
|
return Err(output.err().unwrap().description().into());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use std::char;
|
|
||||||
|
|
||||||
use renderers::html_cleanup::html_cleanup;
|
use renderers::html_cleanup::html_cleanup;
|
||||||
use renderers::strip_blank::strip_blank;
|
use renderers::strip_blank::strip_blank;
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
use renderers::{sciter_start, get_html, destroy_matching, destroy_at, find_first};
|
use renderers::{sciter_start, get_html, destroy_matching, destroy_at, find_first};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use sciter::{Window};
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn html_cleanup(config: Config, input: String) -> Result<String, String> {
|
pub fn html_cleanup(config: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
let mut head = find_first(&mut root, "head");
|
let mut head = find_first(&mut root, "head");
|
||||||
destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason
|
destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason
|
||||||
destroy_matching(&mut head, "meta[content='text/css']");
|
destroy_matching(&mut head, "meta[content='text/css']");
|
||||||
destroy_matching(&mut head, "style");
|
destroy_matching(&mut head, "style");
|
||||||
destroy_matching(&mut head, "title");
|
destroy_matching(&mut head, "title");
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn sciter_start(source: String) -> Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_html(element: Element) -> String {
|
fn get_html(element: Element) -> String {
|
||||||
element.update(true);
|
element.update(true).expect("Failed to update");
|
||||||
return String::from_utf8(element.get_html(true)).expect(&format!(
|
return String::from_utf8(element.get_html(true)).expect(&format!(
|
||||||
"Failed to get HTML from {}.",
|
"Failed to get HTML from {}.",
|
||||||
element.get_tag()
|
element.get_tag()
|
||||||
|
|
Reference in a new issue