Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit bc29d8e

Browse files
committed
Add support for multilingual gitbooks
1 parent 3cc6df8 commit bc29d8e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ module.exports = {
1212
config.label = "Edit This Page";
1313
}
1414

15-
rtEditLink = '<a href="' + config.base + '/' + page.path + '" class="btn fa fa-edit pull-left">&nbsp;&nbsp;' + config.label + '</a>';
15+
// We need to calculate the path this way because multilingual
16+
// books have wrong page.path
17+
path = "/" + page.path;
18+
if(this.options.originalInput !== undefined) {
19+
path = page.rawPath.replace(this.options.originalInput, '');
20+
}
21+
22+
rtEditLink = '<a href="' + config.base + path + '" class="btn fa fa-edit pull-left">&nbsp;&nbsp;' + config.label + '</a>';
1623

1724
page.content = page.content.replace (
1825
'<!-- Actions Right -->',

0 commit comments

Comments
 (0)