Merge pull request #602 from peng1999/fix-warning
Replace trim_{left, right} with trim_{start, end}
This commit is contained in:
commit
77aa640bbc
|
@ -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()
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue