Skip to content

Commit

Permalink
Merge pull request #7 from w-henderson/bug-fixes
Browse files Browse the repository at this point in the history
Made a number of bug fixes
  • Loading branch information
w-henderson authored Nov 20, 2022
2 parents 65ea8c5 + 5d04f19 commit 6265884
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stuart-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stuart_core"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
license = "MIT"
homepage = "https://github.com/w-henderson/Stuart"
Expand Down
4 changes: 2 additions & 2 deletions stuart-core/src/functions/parsers/dateformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Function for DateFormatFunction {

#[cfg(feature = "date")]
fn execute(&self, scope: &mut Scope) -> Result<(), TracebackError<ProcessError>> {
use chrono::{Local, NaiveTime};
use chrono::{NaiveTime, Utc};
use dateparser::parse_with;

let self_token = scope.tokens.current().unwrap().clone();
Expand All @@ -64,7 +64,7 @@ impl Function for DateFormatFunction {
})?;

let date = std::panic::catch_unwind(|| {
parse_with(string, &Local, NaiveTime::from_hms(0, 0, 0))
parse_with(string, &Utc, NaiveTime::from_hms_opt(0, 0, 0).unwrap())
.ok()
.map(|d| d.format(&self.format).to_string())
.ok_or(ProcessError::InvalidDate)
Expand Down
2 changes: 1 addition & 1 deletion stuart-core/src/parse/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn parse_markdown(
};

if dashed_lines == 1 {
let mut parts = line.split(':');
let mut parts = line.splitn(2, ':');
let key = parts.next().ok_or_else(e)?.trim().to_string();

let value = parts
Expand Down
1 change: 1 addition & 0 deletions stuart-core/src/tests/testcases/_base/posts/post_1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Post 1"
date: "2022-09-01"
other_field: "this has a : colon in it"
---

This is post 1
4 changes: 2 additions & 2 deletions stuart/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stuart"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
license = "MIT"
homepage = "https://github.com/w-henderson/Stuart"
Expand All @@ -15,7 +15,7 @@ name = "stuart"
path = "src/main.rs"

[dependencies]
stuart_core = { version = "^0.2.1", path = "../stuart-core" }
stuart_core = { version = "^0.2.2", path = "../stuart-core" }

clap = "^3.2"
toml = "^0.5"
Expand Down

0 comments on commit 6265884

Please sign in to comment.