Skip to content

Commit a36ecf6

Browse files
committed
devonfw/solutions#82 add rule for editlinks
1 parent 73d12ca commit a36ecf6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

website/shared/editlinks.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ const editLinksModule = (function(window) {
99
if(matches){
1010
if(rule.index !== undefined){
1111
result = matches[rule.index];
12-
} else {
12+
}
13+
else if(rule.rule !== undefined){
14+
result = rule.rule(matches);
15+
}
16+
else {
1317
result = rule.value;
1418
}
1519
return true;
@@ -96,7 +100,7 @@ const editLinksModule = (function(window) {
96100
},
97101
{
98102
re: /solutions\/(solution\/[^\/]*)/,
99-
index: 1
103+
rule: (matches) => matches[1].replace('solution/','solutions/')
100104
},
101105
{
102106
re: /solutions\//,
@@ -199,7 +203,6 @@ const editLinksModule = (function(window) {
199203
if(repoName) {
200204
let folderName = getFolderName();
201205
let branchName = getBranchName();
202-
folderName = folderName.replace('solution/','solutions/');
203206
let urlPrefix = "https://github.com/devonfw/" + repoName + "/edit/" + branchName + "/" + folderName + "/";
204207
$('h2,h3,h4,h5').each(function() {
205208
let headline = $( this );

0 commit comments

Comments
 (0)