proposed addition for path containing filename #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@contrext : I was on the impression that I submitted this yesterday, but I might not have press the button. This fix is to add a functionality to the function
relpath:fixRelativePath
. Since this function is used extensively, I propose the patch in a Pull Request so you can review it.Given path with filename
relpath:fixRelativePath('concept/topicA.html', 'concept/topicB.html')
, will return../topicB.html
instead oftopicB.html
because the function was not designed to support path with filename. The issue is not with this function, but the functionrelpath:analyzePathTokens
which is called byrelpath:fixRelativePath
I propose to add a fix to
relpath:analyzePathTokens
. I do not really like but I could not find a better way. The function tokenize the path, and evaluate each token. It append one ".." for each token left in the source but it does not check if the token is a filename. In the fix, the code simply check if the token contains an file extension, and if true, it does not append a ".." in that case. See line 767 to 775An other option might be to duplicate the function