File tree Expand file tree Collapse file tree 5 files changed +19
-6
lines changed Expand file tree Collapse file tree 5 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const URL = require ( 'url' ) ;
43const _ = {
54 defaultsDeep : require ( 'lodash.defaultsdeep' ) ,
65 isEmpty : require ( 'lodash.isempty' ) ,
@@ -9,6 +8,7 @@ const _ = {
98// -----------------------------------------------------------------------------
109
1110const LIB = require ( './lib' ) ;
11+ const UTIL = require ( './lib/UTIL' ) ;
1212
1313// -----------------------------------------------------------------------------
1414
@@ -361,7 +361,7 @@ PLUGIN.get_feed_url = feed =>
361361
362362 if ( feed . enable && feed . file_name )
363363 {
364- return URL . resolve ( PLUGIN . options . canonical_base , feed . file_name ) ;
364+ return UTIL . resolve_url ( PLUGIN . options . canonical_base , feed . file_name ) ;
365365 }
366366
367367} ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const URL = require ( 'url' ) ;
43const _ = { isEmpty : require ( 'lodash.isempty' ) } ;
54
65// -----------------------------------------------------------------------------
@@ -11,6 +10,7 @@ const { chalk: CHALK } = require('@vuepress/shared-utils');
1110
1211const LIB = {
1312 LOG : require ( './LOG' ) ,
13+ UTIL : require ( './UTIL' ) ,
1414} ;
1515
1616// -----------------------------------------------------------------------------
@@ -59,7 +59,7 @@ class Head
5959
6060 if ( feed . head_link . enable && feed . enable && feed . file_name )
6161 {
62- return URL . resolve ( this . canonical_base , feed . file_name ) ;
62+ return LIB . UTIL . resolve_url ( this . canonical_base , feed . file_name ) ;
6363 }
6464
6565 }
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const URL = require ( 'url' ) ;
43const _ = { isEmpty : require ( 'lodash.isempty' ) } ;
54
65// -----------------------------------------------------------------------------
@@ -96,7 +95,7 @@ class Page
9695
9796 if ( this . canonical_base && path )
9897 {
99- return URL . resolve ( this . canonical_base , path ) ;
98+ return LIB . UTIL . resolve_url ( this . canonical_base , path ) ;
10099 }
101100
102101 }
Original file line number Diff line number Diff line change 44
55const REMOVE_MARKDOWN = require ( 'remove-markdown' ) ;
66const STRIPTAGS = require ( 'striptags' ) ;
7+ const _ = {
8+ trimEnd : require ( 'lodash.trimend' ) ,
9+ trimStart : require ( 'lodash.trimstart' ) ,
10+ } ;
711
812// -----------------------------------------------------------------------------
913
1014const UTIL = { } ;
1115
1216// -----------------------------------------------------------------------------
1317
18+
19+ /**
20+ * @return {string }
21+ */
22+ UTIL . resolve_url = ( base , path ) =>
23+ `${ _ . trimEnd ( base , '/' ) } /${ _ . trimStart ( path , '/' ) } ` ;
24+
25+
1426/**
1527 * @return {string }
1628 */
Original file line number Diff line number Diff line change 4242 "feed" : " 2.0.4" ,
4343 "lodash.defaultsdeep" : " 4.6.1" ,
4444 "lodash.isempty" : " 4.4.0" ,
45+ "lodash.trimend" : " ^4.5.1" ,
46+ "lodash.trimstart" : " ^4.5.1" ,
4547 "remove-markdown" : " 0.3.0" ,
4648 "striptags" : " 3.1.1"
4749 },
You can’t perform that action at this time.
0 commit comments