about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--TODO7
-rwxr-xr-xreadme.md6
-rwxr-xr-xsrc/main.rs18
-rwxr-xr-xsrc/timeparse.rs13
4 files changed, 27 insertions, 17 deletions
diff --git a/TODO b/TODO
index 5ee90f8..f9d467c 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,9 @@
 (1) Using incorrect daylight savings offset for date should warn
 	Like using CDT when we are not in dalyight savings. CST would be
 	correct, but maybe it was on purpose? We should not hard-error,
-	just print somewhere so we see it Someday.
\ No newline at end of file
+	just print somewhere so we see it Someday.
+
+(2) Configurable Logging
+	Learn how to use tracing better so we can mark CSS and Images
+	with their file type in the traces and filter them out if we
+	want to.
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 648b984..d2ebc7f 100755
--- a/readme.md
+++ b/readme.md
@@ -89,7 +89,7 @@ a one or two sentence description of the page.
 remove a path component from the end of tree when displaying with the
 **path** pattern
 
-**published**  
+**published**  (default: none)  
 use this with the `published` pattern to insert the publish date.
 
 ### patterns
@@ -140,4 +140,8 @@ Acceptable formats:
 If no time is provided, noon is assumed.  
 If no offset is provided, Central Time with the correct DST is assumed.
 
+Time must be in one of the following formats:
+- 24-hour time with a leading zero: `02:56`
+- 12-hour time with no leading zero and an am/pm: `2:56am`
+
 Known timezones: `CST`, `CDT`
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index 0ddbb51..fa1ac5c 100755
--- a/src/main.rs
+++ b/src/main.rs
@@ -132,17 +132,9 @@ async fn falible_handler(
 		let content = Filesystem::read_to_string(&resolve.filepath).await?;
 
 		let result = Templated::from_str(&content);
-		tracing::trace!("full return from Templated::from_str");
 
 		match result {
-			Ok(templated) => {
-				//tracing::trace!("sending template for {resolve}");
-
-				std::io::stdout().write_all(b"meow meow meow!!").unwrap();
-				std::io::stdout().flush().unwrap();
-
-				send_template(templated, resolve, webpath, settings).await
-			}
+			Ok(templated) => send_template(templated, resolve, webpath, settings, sid).await,
 			Err(e) => {
 				tracing::warn!("error sending template {e}");
 
@@ -212,8 +204,9 @@ async fn send_template(
 	resolve: PathResolution,
 	webpath: Webpath,
 	settings: Settings,
+	sid: SessionId,
 ) -> Result<Response, RuntimeError> {
-	tracing::trace!("sending template");
+	tracing::trace!("[{sid}] sending template");
 	let template_stem = templated.frontmatter.get("template").expect("no template");
 	let template_name = Utf8PathBuf::from(format!("{template_stem}.html"));
 	let template_path = settings.template_dir.join(template_name);
@@ -247,7 +240,7 @@ async fn send_template(
 			let og_image_alt = match templated.frontmatter.get("art_alt") {
 				Some(alt) => alt,
 				None => {
-					tracing::warn!("{} has art but no alt", resolve.filepath);
+					tracing::warn!("[{sid}] {} has art but no alt", resolve.filepath);
 					""
 				}
 			};
@@ -271,7 +264,6 @@ async fn send_template(
 		template.set_pattern(pat);
 	}
 
-	tracing::trace!("poppin'!");
 	// path to the file for navigation
 	let mut path: Vec<&str> = webpath.webcanon.iter().collect();
 	// we don't want the directory/filename itself
@@ -287,7 +279,7 @@ async fn send_template(
 			None => 0,
 			Some(Err(_)) => {
 				tracing::error!(
-					"path-offset in template {} is not an integer",
+					"[{sid}] path-offset in template {} is not an integer",
 					resolve.filepath
 				);
 
diff --git a/src/timeparse.rs b/src/timeparse.rs
index 5df731e..4d5f63f 100755
--- a/src/timeparse.rs
+++ b/src/timeparse.rs
@@ -119,9 +119,18 @@ pub fn parse(raw: &str) -> Result<OffsetDateTime, time::error::Parse> {
 		Some(raw) => parse_time(raw)?,
 	};
 
+	let calculated_offset = us_dst_central_offset(PrimitiveDateTime::new(date, time));
 	let offset = match splits.next() {
-		None => us_dst_central_offset(PrimitiveDateTime::new(date, time)),
-		Some(raw) => parse_offset(raw),
+		None => calculated_offset,
+		Some(raw) => {
+			let offset = parse_offset(raw);
+			if offset != calculated_offset {
+				//FIXME: gen 2024-12; warn here but format it rightly.
+				()
+			}
+
+			offset
+		}
 	};
 
 	Ok(OffsetDateTime::new_in_offset(date, time, offset))