@@ -5,7 +5,7 @@ use serde_derive::{Deserialize, Serialize};
5
5
use std:: path:: { Path , PathBuf } ;
6
6
7
7
#[ derive( Debug , PartialEq , Deserialize ) ]
8
- struct YamlHeader {
8
+ struct TomlHeader {
9
9
title : String ,
10
10
author : String ,
11
11
#[ serde( default ) ]
@@ -55,18 +55,18 @@ impl Post {
55
55
) ) ;
56
56
}
57
57
58
- // yaml headers.... we know the first four bytes of each file are "--- \n"
58
+ // toml headers.... we know the first four bytes of each file are "+++ \n"
59
59
// so we need to find the end. we need the fours to adjust for those first bytes
60
- let end_of_yaml = contents[ 4 ..] . find ( "--- " ) . unwrap ( ) + 4 ;
61
- let yaml = & contents[ ..end_of_yaml ] ;
62
- let YamlHeader {
60
+ let end_of_toml = contents[ 4 ..] . find ( "+++ " ) . unwrap ( ) + 4 ;
61
+ let toml = & contents[ 4 ..end_of_toml ] ;
62
+ let TomlHeader {
63
63
author,
64
64
title,
65
65
release,
66
66
team : team_string,
67
67
layout,
68
- } = serde_yaml :: from_str ( yaml ) ?;
69
- // next, the contents. we add + to get rid of the final "---\n\n"
68
+ } = toml :: from_str ( toml ) ?;
69
+
70
70
let options = comrak:: Options {
71
71
render : comrak:: RenderOptions :: builder ( ) . unsafe_ ( true ) . build ( ) ,
72
72
extension : comrak:: ExtensionOptions :: builder ( )
@@ -78,8 +78,8 @@ impl Post {
78
78
..comrak:: Options :: default ( )
79
79
} ;
80
80
81
- // Content starts after "--- \n" (we don't assume an extra newline)
82
- let contents = comrak:: markdown_to_html ( & contents[ end_of_yaml + 4 ..] , & options) ;
81
+ // Content starts after "+++ \n" (we don't assume an extra newline)
82
+ let contents = comrak:: markdown_to_html ( & contents[ end_of_toml + 4 ..] , & options) ;
83
83
84
84
// finally, the url.
85
85
let mut url = PathBuf :: from ( & * filename) ;
0 commit comments