fixed getRelativePath in lib/path.awk
This commit is contained in:
parent
cb71f73b96
commit
56baeefaf6
|
@ -30,8 +30,8 @@ function resolvePath(path, resolvedPath, pathComponents) {
|
|||
}
|
||||
|
||||
function getRelativePath(base, path, resolvedPath, baseComponents, pathComponents, commonPrefix) {
|
||||
path = resolvePath(ENVIRON["PWD"] "/" path)
|
||||
base = resolvePath(ENVIRON["PWD"] "/" base)
|
||||
path = resolvePath(path)
|
||||
base = resolvePath(base)
|
||||
pathComponents[1] = ""
|
||||
baseComponents[1] = ""
|
||||
isCommonPrefixUnfinished = 1
|
||||
|
@ -39,6 +39,9 @@ function getRelativePath(base, path, resolvedPath, baseComponents, pathComponent
|
|||
sub(/\/+$/, "", base)
|
||||
sub(/\/+$/, "", path)
|
||||
|
||||
split(path, pathComponents, "/")
|
||||
split(base, baseComponents, "/")
|
||||
|
||||
for (i in pathComponents)
|
||||
if (baseComponents[i] == pathComponents[i] && isCommonPrefixUnfinished)
|
||||
resolvedPath = resolvedPath "../"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Navigation:
|
||||
=> gmi/index.gmi home
|
||||
=> gmi/sitemap.gmi sitemap
|
||||
=> gmi/feed.atom feed
|
||||
=> gmi/index.gmi/ home
|
||||
=> gmi/sitemap.gmi/ sitemap
|
||||
=> gmi/feed.atom/ feed
|
||||
=> http://git.vern.cc/techn0path/ git
|
||||
|
||||
# Testing Input
|
||||
|
|
|
@ -17,9 +17,9 @@ hr { max-width: 70ch; }
|
|||
<body>
|
||||
<header>
|
||||
<nav id='navbar'>
|
||||
<a href='../html/index.html'>home</a> |
|
||||
<a href='../html/sitemap.html'>sitemap</a> |
|
||||
<a href='../html/feed.atom'>feed</a> |
|
||||
<a href='html/index.html/'>home</a> |
|
||||
<a href='html/sitemap.html/'>sitemap</a> |
|
||||
<a href='html/feed.atom/'>feed</a> |
|
||||
<a href='http://git.vern.cc/techn0path/'>git</a>
|
||||
</nav><br>
|
||||
|
||||
|
|
Loading…
Reference in New Issue