1
1
let { repr } = require ( "faucet-pipeline-core/lib/util" ) ;
2
- let colonParse = require ( "metacolon" ) ;
2
+ let metacolon = import ( "metacolon" ) ;
3
3
4
4
module . exports = class Page {
5
5
constructor ( slug , sourcePath , children , { language, title, description, meta } , dataPath ) {
@@ -19,19 +19,21 @@ module.exports = class Page {
19
19
return Promise . resolve ( this ) ;
20
20
}
21
21
22
- let { headers, body } = await colonParse ( this . sourcePath ) ;
22
+ let { colonParse } = await metacolon ;
23
+ let { headers, body } = await colonParse ( this . sourcePath , { trim : true } ) ;
23
24
if ( this . dataPath ) {
24
25
this . data = require ( this . dataPath ) ;
25
26
}
26
- this . language = headers . language || this . config . language ;
27
- this . heading = headers . title ;
28
- this . title = [ headers . title , this . config . title ] . filter ( x => x ) . join ( " | " ) ;
29
- this . description = headers . description || this . config . description ;
27
+ let title = headers . get ( "title" ) ;
28
+ this . language = headers . get ( "language" ) || this . config . language ;
29
+ this . heading = title ;
30
+ this . title = [ title , this . config . title ] . filter ( x => x ) . join ( " | " ) ;
31
+ this . description = headers . get ( "description" ) || this . config . description ;
30
32
this . meta = this . buildMeta ( ) ;
31
- this . status = headers . status ;
32
- this . version = headers . version ;
33
- this . tags = headers . tags ;
34
- this . body = body ;
33
+ this . status = headers . get ( " status" ) ;
34
+ this . version = headers . get ( " version" ) ;
35
+ this . tags = headers . get ( " tags" ) ;
36
+ this . body = body . trim ( ) ;
35
37
return this ;
36
38
}
37
39
0 commit comments