Replace trim_{left, right} with trim_{start, end}
trim_{start, end} is introduced in rust 1.30.0 and trim_{left, right} is deprecated since 1.33.0.
This commit is contained in:
parent
9398ab789c
commit
0b897ce7c7
|
@ -153,7 +153,7 @@ impl Page {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ref p) = page.meta.path {
|
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 {
|
} else {
|
||||||
let mut path = if page.file.components.is_empty() {
|
let mut path = if page.file.components.is_empty() {
|
||||||
page.slug.clone()
|
page.slug.clone()
|
||||||
|
|
|
@ -108,7 +108,7 @@ fn render_shortcode(
|
||||||
}
|
}
|
||||||
if let Some(ref b) = body {
|
if let Some(ref b) = body {
|
||||||
// Trimming right to avoid most shortcodes with bodies ending up with a HTML new line
|
// 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());
|
tera_context.extend(context.tera_context.clone());
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ pub fn markdown(value: &Value, args: &HashMap<String, Value>) -> TeraResult<Valu
|
||||||
|
|
||||||
if inline {
|
if inline {
|
||||||
html = html
|
html = html
|
||||||
.trim_left_matches("<p>")
|
.trim_start_matches("<p>")
|
||||||
// pulldown_cmark finishes a paragraph with `</p>\n`
|
// pulldown_cmark finishes a paragraph with `</p>\n`
|
||||||
.trim_right_matches("</p>\n")
|
.trim_end_matches("</p>\n")
|
||||||
.to_string();
|
.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 search = ask_bool("> Do you want to build a search index of the content?", false)?;
|
||||||
|
|
||||||
let config = CONFIG
|
let config = CONFIG
|
||||||
.trim_left()
|
.trim_start()
|
||||||
.replace("%BASE_URL%", &base_url)
|
.replace("%BASE_URL%", &base_url)
|
||||||
.replace("%COMPILE_SASS%", &format!("{}", compile_sass))
|
.replace("%COMPILE_SASS%", &format!("{}", compile_sass))
|
||||||
.replace("%SEARCH%", &format!("{}", search))
|
.replace("%SEARCH%", &format!("{}", search))
|
||||||
|
|
Loading…
Reference in New Issue