File tree 5 files changed +19
-6
lines changed
5 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- const URL = require ( 'url' ) ;
4
3
const _ = {
5
4
defaultsDeep : require ( 'lodash.defaultsdeep' ) ,
6
5
isEmpty : require ( 'lodash.isempty' ) ,
@@ -9,6 +8,7 @@ const _ = {
9
8
// -----------------------------------------------------------------------------
10
9
11
10
const LIB = require ( './lib' ) ;
11
+ const UTIL = require ( './lib/UTIL' ) ;
12
12
13
13
// -----------------------------------------------------------------------------
14
14
@@ -361,7 +361,7 @@ PLUGIN.get_feed_url = feed =>
361
361
362
362
if ( feed . enable && feed . file_name )
363
363
{
364
- return URL . resolve ( PLUGIN . options . canonical_base , feed . file_name ) ;
364
+ return UTIL . resolve_url ( PLUGIN . options . canonical_base , feed . file_name ) ;
365
365
}
366
366
367
367
} ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- const URL = require ( 'url' ) ;
4
3
const _ = { isEmpty : require ( 'lodash.isempty' ) } ;
5
4
6
5
// -----------------------------------------------------------------------------
@@ -11,6 +10,7 @@ const { chalk: CHALK } = require('@vuepress/shared-utils');
11
10
12
11
const LIB = {
13
12
LOG : require ( './LOG' ) ,
13
+ UTIL : require ( './UTIL' ) ,
14
14
} ;
15
15
16
16
// -----------------------------------------------------------------------------
@@ -59,7 +59,7 @@ class Head
59
59
60
60
if ( feed . head_link . enable && feed . enable && feed . file_name )
61
61
{
62
- return URL . resolve ( this . canonical_base , feed . file_name ) ;
62
+ return LIB . UTIL . resolve_url ( this . canonical_base , feed . file_name ) ;
63
63
}
64
64
65
65
}
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- const URL = require ( 'url' ) ;
4
3
const _ = { isEmpty : require ( 'lodash.isempty' ) } ;
5
4
6
5
// -----------------------------------------------------------------------------
@@ -96,7 +95,7 @@ class Page
96
95
97
96
if ( this . canonical_base && path )
98
97
{
99
- return URL . resolve ( this . canonical_base , path ) ;
98
+ return LIB . UTIL . resolve_url ( this . canonical_base , path ) ;
100
99
}
101
100
102
101
}
Original file line number Diff line number Diff line change 4
4
5
5
const REMOVE_MARKDOWN = require ( 'remove-markdown' ) ;
6
6
const STRIPTAGS = require ( 'striptags' ) ;
7
+ const _ = {
8
+ trimEnd : require ( 'lodash.trimend' ) ,
9
+ trimStart : require ( 'lodash.trimstart' ) ,
10
+ } ;
7
11
8
12
// -----------------------------------------------------------------------------
9
13
10
14
const UTIL = { } ;
11
15
12
16
// -----------------------------------------------------------------------------
13
17
18
+
19
+ /**
20
+ * @return {string }
21
+ */
22
+ UTIL . resolve_url = ( base , path ) =>
23
+ `${ _ . trimEnd ( base , '/' ) } /${ _ . trimStart ( path , '/' ) } ` ;
24
+
25
+
14
26
/**
15
27
* @return {string }
16
28
*/
Original file line number Diff line number Diff line change 42
42
"feed" : " 2.0.4" ,
43
43
"lodash.defaultsdeep" : " 4.6.1" ,
44
44
"lodash.isempty" : " 4.4.0" ,
45
+ "lodash.trimend" : " ^4.5.1" ,
46
+ "lodash.trimstart" : " ^4.5.1" ,
45
47
"remove-markdown" : " 0.3.0" ,
46
48
"striptags" : " 3.1.1"
47
49
},
You can’t perform that action at this time.
0 commit comments