File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -190,17 +190,17 @@ function normalizeHtml(src, options) {
190
190
if ( links . isAnchor ( href ) ) {
191
191
// Keep it as it is
192
192
} else if ( links . isRelative ( href ) ) {
193
- var parts = url . parse ( path . join ( options . base , href ) ) ;
194
- var absolutePath = parts . pathname ;
195
- var anchor = parts . hash ;
193
+ var parts = url . parse ( href ) ;
194
+ var absolutePath = path . join ( options . base , parts . pathname ) ;
195
+ var anchor = parts . hash || "" ;
196
196
197
197
// If is in navigation relative: transform as content
198
198
if ( options . navigation [ absolutePath ] ) {
199
- href = options . book . contentLink ( href ) ;
199
+ absolutePath = options . book . contentLink ( absolutePath ) ;
200
200
}
201
201
202
202
// Transform as absolute
203
- href = links . toAbsolute ( href , options . base , options . output ) + anchor ;
203
+ href = links . toAbsolute ( "/" + absolutePath , options . base , options . output ) + anchor ;
204
204
} else {
205
205
// External links
206
206
$ ( this ) . attr ( "target" , "_blank" ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ describe('JSON generator', function () {
21
21
assert ( fs . existsSync ( path . join ( output , "sub/test1.json" ) ) ) ;
22
22
23
23
var test1 = JSON . parse ( fs . readFileSync ( path . join ( output , "sub/test1.json" ) ) ) ;
24
- assert ( test1 . sections [ 0 ] . content . indexOf ( "intro .html" ) > 0 ) ;
24
+ assert ( test1 . sections [ 0 ] . content . indexOf ( "index .html" ) > 0 ) ;
25
25
} , done ) ;
26
26
} ) ;
27
27
You can’t perform that action at this time.
0 commit comments