From b396e718aa99546a05499d11cbd56287dfccbfea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Patr=C3=ADcio?= Date: Wed, 3 May 2023 04:38:29 +0100 Subject: [PATCH 1/4] Update index.js Improved path conversion to allow any number of subpaths --- src/utils/index.js | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 082e818f2..7e3b811cd 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,27 +1,12 @@ function convertPathToHtml(path) { - let count = 0 + let htmlpath = '' while (path.startsWith('../')) { - count++ path = path.slice(3) + if (htmlpath.length < 2) htmlpath += '.' + else htmlpath += '/..' } - if (count === 1) { - return '.' - } - - if (count === 2) { - return '..' - } - - if (count === 3) { - return '../..' - } - - if (count === 4) { - return '../../..' - } - - return '' + return htmlpath } export { convertPathToHtml } From 3e1133679b4f5cb956f58ea712a6abb392ddb8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Patr=C3=ADcio?= Date: Thu, 4 May 2023 13:51:03 +0100 Subject: [PATCH 2/4] Update index.js lint fixed --- src/utils/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 7e3b811cd..28daf68d6 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -2,10 +2,13 @@ function convertPathToHtml(path) { let htmlpath = '' while (path.startsWith('../')) { path = path.slice(3) - if (htmlpath.length < 2) htmlpath += '.' - else htmlpath += '/..' + if (htmlpath.length < 2) { + htmlpath += '.' + } + else { + htmlpath += '/..' + } } - return htmlpath } From 5aca6b1082e59ae77de9ebaa1ee549c1422e4d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Patr=C3=ADcio?= Date: Mon, 8 May 2023 11:03:40 +0100 Subject: [PATCH 3/4] fixed lint --- src/utils/index.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 28daf68d6..b33274957 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -2,13 +2,9 @@ function convertPathToHtml(path) { let htmlpath = '' while (path.startsWith('../')) { path = path.slice(3) - if (htmlpath.length < 2) { - htmlpath += '.' - } - else { - htmlpath += '/..' - } + htmlpath.length < 2 ? htmlpath += '.' : htmlpath += '/..' } + return htmlpath } From 2458b90417da26345df2eafb58d8c21fc2dd3f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Patr=C3=ADcio?= Date: Mon, 8 May 2023 11:16:55 +0100 Subject: [PATCH 4/4] fixed lint errors --- src/utils/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index b33274957..01e29f977 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -2,9 +2,9 @@ function convertPathToHtml(path) { let htmlpath = '' while (path.startsWith('../')) { path = path.slice(3) - htmlpath.length < 2 ? htmlpath += '.' : htmlpath += '/..' + htmlpath += htmlpath.length < 2 ? '.' : '/..' } - + return htmlpath }