Fix windows lineending

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/19/head
trivernis 4 years ago
parent 4c0d4c560c
commit f709465eba
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

2
Cargo.lock generated

@ -2315,7 +2315,7 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]] [[package]]
name = "snekdown" name = "snekdown"
version = "0.33.1" version = "0.33.2"
dependencies = [ dependencies = [
"asciimath-rs", "asciimath-rs",
"base64 0.12.3", "base64 0.12.3",

@ -1,6 +1,6 @@
[package] [package]
name = "snekdown" name = "snekdown"
version = "0.33.1" version = "0.33.2"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license-file = "LICENSE" license-file = "LICENSE"

@ -111,9 +111,7 @@ impl ToHtml for Document {
writer.write("<!DOCTYPE html>".to_string())?; writer.write("<!DOCTYPE html>".to_string())?;
writer.write("<html lang=\"".to_string())?; writer.write("<html lang=\"".to_string())?;
writer.write_attribute(metadata.language)?; writer.write_attribute(metadata.language)?;
writer.write("\"><head ".to_string())?; writer.write("\"><head>".to_string())?;
writer.write(path)?;
writer.write("/>".to_string())?;
writer.write("<meta charset=\"UTF-8\">".to_string())?; writer.write("<meta charset=\"UTF-8\">".to_string())?;
if let Some(author) = metadata.author { if let Some(author) = metadata.author {

@ -101,6 +101,7 @@ impl Parser {
pub fn with_defaults(options: ParserOptions) -> Self { pub fn with_defaults(options: ParserOptions) -> Self {
let text = if let Some(path) = &options.path { let text = if let Some(path) = &options.path {
let mut text = read_to_string(&path).unwrap(); let mut text = read_to_string(&path).unwrap();
text = text.replace("\r\n", "\n");
if text.chars().last() != Some('\n') { if text.chars().last() != Some('\n') {
text.push('\n'); text.push('\n');
} }

Loading…
Cancel
Save