Fixes #16: New lines lost when only a \n is given

This commit is contained in:
jordan@doyle.la 2020-07-23 15:15:57 +01:00
parent 598baa2ace
commit 54f531a0a8
No known key found for this signature in database
GPG Key ID: 1EA6BAE6F66DC49A
2 changed files with 4 additions and 4 deletions

6
Cargo.lock generated
View File

@ -1074,7 +1074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rocket"
version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#56a617262525de758cb47a0d71049db948f24bbd"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#adc79016cdfe732a6c095dd96aa5286a70c4d3be"
dependencies = [
"async-trait 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1099,7 +1099,7 @@ dependencies = [
[[package]]
name = "rocket_codegen"
version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#56a617262525de758cb47a0d71049db948f24bbd"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#adc79016cdfe732a6c095dd96aa5286a70c4d3be"
dependencies = [
"devise 0.3.0 (git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691)",
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1111,7 +1111,7 @@ dependencies = [
[[package]]
name = "rocket_http"
version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#56a617262525de758cb47a0d71049db948f24bbd"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#adc79016cdfe732a6c095dd96aa5286a70c4d3be"
dependencies = [
"cookie 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -111,7 +111,7 @@ async fn show_paste(key: String, plaintext: IsPlaintextRequest) -> Result<Conten
// Add <code> tags to enable line numbering with CSS
let html = format!(
"<code>{}</code>",
code_highlighted.replace("\n", "</code><code>")
code_highlighted.replace("\n", "\n</code><code>")
);
let content = MarkupDisplay::new_safe(Cow::Borrowed(&html), AskamaHtml);