Merge pull request #602 from peng1999/fix-warning

Replace trim_{left, right} with trim_{start, end}
This commit is contained in:
Vincent Prouillet 2019-01-29 18:15:06 +01:00 committed by GitHub
commit 77aa640bbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -153,7 +153,7 @@ impl Page {
};
if let Some(ref p) = page.meta.path {
page.path = p.trim().trim_left_matches('/').to_string();
page.path = p.trim().trim_start_matches('/').to_string();
} else {
let mut path = if page.file.components.is_empty() {
page.slug.clone()

View file

@ -108,7 +108,7 @@ fn render_shortcode(
}
if let Some(ref b) = body {
// Trimming right to avoid most shortcodes with bodies ending up with a HTML new line
tera_context.insert("body", b.trim_right());
tera_context.insert("body", b.trim_end());
}
tera_context.extend(context.tera_context.clone());

View file

@ -21,9 +21,9 @@ pub fn markdown(value: &Value, args: &HashMap<String, Value>) -> TeraResult<Valu
if inline {
html = html
.trim_left_matches("<p>")
.trim_start_matches("<p>")
// pulldown_cmark finishes a paragraph with `</p>\n`
.trim_right_matches("</p>\n")
.trim_end_matches("</p>\n")
.to_string();
}

View file

@ -41,7 +41,7 @@ pub fn create_new_project(name: &str) -> Result<()> {
let search = ask_bool("> Do you want to build a search index of the content?", false)?;
let config = CONFIG
.trim_left()
.trim_start()
.replace("%BASE_URL%", &base_url)
.replace("%COMPILE_SASS%", &format!("{}", compile_sass))
.replace("%SEARCH%", &format!("{}", search))