@@ -261,70 +261,69 @@ fn parse_frontmatter_fields(
261261 }
262262
263263 // Try to parse as YAML via serde_yaml
264- if let Ok ( yaml) = serde_yaml:: from_str :: < serde_yaml:: Value > ( inner) {
265- if let Some ( map) = yaml. as_mapping ( ) {
266- for ( k , v ) in map {
267- let key = match k . as_str ( ) {
268- Some ( s ) => s . to_string ( ) ,
269- None => continue ,
270- } ;
271- match key . as_str ( ) {
272- "tags" => {
273- if let Some ( seq ) = v . as_sequence ( ) {
274- for item in seq {
275- if let Some ( s ) = item . as_str ( ) {
276- tags . push ( s . to_string ( ) ) ;
277- }
264+ if let Ok ( yaml) = serde_yaml:: from_str :: < serde_yaml:: Value > ( inner)
265+ && let Some ( map) = yaml. as_mapping ( )
266+ {
267+ for ( k , v ) in map {
268+ let key = match k . as_str ( ) {
269+ Some ( s ) => s . to_string ( ) ,
270+ None => continue ,
271+ } ;
272+ match key . as_str ( ) {
273+ "tags" => {
274+ if let Some ( seq ) = v . as_sequence ( ) {
275+ for item in seq {
276+ if let Some ( s ) = item . as_str ( ) {
277+ tags . push ( s . to_string ( ) ) ;
278278 }
279- } else if let Some ( s ) = v . as_str ( ) {
280- // Handle inline `tags: foo` or `tags: [a, b]` parsed as string
281- for t in s . split ( ',' ) {
282- let t = t . trim ( ) ;
283- if !t . is_empty ( ) {
284- tags . push ( t . to_string ( ) ) ;
285- }
279+ }
280+ } else if let Some ( s ) = v . as_str ( ) {
281+ // Handle inline `tags: foo` or `tags: [a, b]` parsed as string
282+ for t in s . split ( ',' ) {
283+ let t = t . trim ( ) ;
284+ if !t . is_empty ( ) {
285+ tags . push ( t . to_string ( ) ) ;
286286 }
287287 }
288288 }
289- "aliases" => {
290- if let Some ( seq ) = v . as_sequence ( ) {
291- for item in seq {
292- if let Some ( s ) = item . as_str ( ) {
293- aliases . push ( s . to_string ( ) ) ;
294- }
289+ }
290+ "aliases" => {
291+ if let Some ( seq ) = v . as_sequence ( ) {
292+ for item in seq {
293+ if let Some ( s ) = item . as_str ( ) {
294+ aliases . push ( s . to_string ( ) ) ;
295295 }
296- } else if let Some ( s ) = v . as_str ( ) {
297- for a in s . split ( ',' ) {
298- let a = a . trim ( ) ;
299- if !a . is_empty ( ) {
300- aliases . push ( a . to_string ( ) ) ;
301- }
296+ }
297+ } else if let Some ( s ) = v . as_str ( ) {
298+ for a in s . split ( ',' ) {
299+ let a = a . trim ( ) ;
300+ if !a . is_empty ( ) {
301+ aliases . push ( a . to_string ( ) ) ;
302302 }
303303 }
304304 }
305- _ => {
306- // Serialize value back to a string representation
307- let val_str = match v {
308- serde_yaml:: Value :: String ( s) => s. clone ( ) ,
309- serde_yaml:: Value :: Number ( n) => n. to_string ( ) ,
310- serde_yaml:: Value :: Bool ( b) => b. to_string ( ) ,
311- serde_yaml:: Value :: Null => String :: new ( ) ,
312- other => {
313- // serde_yaml may parse dates/timestamps as tagged
314- // values. Serialize and clean up the output.
315- let raw = serde_yaml:: to_string ( other)
316- . unwrap_or_default ( )
317- . trim_start_matches ( "---" )
318- . trim ( )
319- . to_string ( ) ;
320- // Strip YAML sequence prefix artifacts (e.g., "- - 2026-03-31" → "2026-03-31")
321- let cleaned = raw. trim_start_matches ( "- " ) . trim ( ) . to_string ( ) ;
322- cleaned
323- }
324- } ;
325- if !val_str. is_empty ( ) {
326- scalars. insert ( key, val_str) ;
305+ }
306+ _ => {
307+ // Serialize value back to a string representation
308+ let val_str = match v {
309+ serde_yaml:: Value :: String ( s) => s. clone ( ) ,
310+ serde_yaml:: Value :: Number ( n) => n. to_string ( ) ,
311+ serde_yaml:: Value :: Bool ( b) => b. to_string ( ) ,
312+ serde_yaml:: Value :: Null => String :: new ( ) ,
313+ other => {
314+ // serde_yaml may parse dates/timestamps as tagged
315+ // values. Serialize and clean up the output.
316+ let raw = serde_yaml:: to_string ( other)
317+ . unwrap_or_default ( )
318+ . trim_start_matches ( "---" )
319+ . trim ( )
320+ . to_string ( ) ;
321+ // Strip YAML sequence prefix artifacts (e.g., "- - 2026-03-31" → "2026-03-31")
322+ raw. trim_start_matches ( "- " ) . trim ( ) . to_string ( )
327323 }
324+ } ;
325+ if !val_str. is_empty ( ) {
326+ scalars. insert ( key, val_str) ;
328327 }
329328 }
330329 }
0 commit comments