@@ -5,7 +5,7 @@ use serde_derive::{Deserialize, Serialize};
55use std:: path:: { Path , PathBuf } ;
66
77#[ derive( Debug , PartialEq , Deserialize ) ]
8- struct YamlHeader {
8+ struct TomlHeader {
99 title : String ,
1010 author : String ,
1111 #[ serde( default ) ]
@@ -55,18 +55,18 @@ impl Post {
5555 ) ) ;
5656 }
5757
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"
5959 // 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 {
6363 author,
6464 title,
6565 release,
6666 team : team_string,
6767 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+
7070 let options = comrak:: Options {
7171 render : comrak:: RenderOptions :: builder ( ) . unsafe_ ( true ) . build ( ) ,
7272 extension : comrak:: ExtensionOptions :: builder ( )
@@ -78,8 +78,8 @@ impl Post {
7878 ..comrak:: Options :: default ( )
7979 } ;
8080
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) ;
8383
8484 // finally, the url.
8585 let mut url = PathBuf :: from ( & * filename) ;
0 commit comments