diff options
Diffstat (limited to 'lib/utils/location.js')
-rw-r--r-- | lib/utils/location.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/utils/location.js b/lib/utils/location.js index ba43644..f1159f1 100644 --- a/lib/utils/location.js +++ b/lib/utils/location.js @@ -30,9 +30,14 @@ function normalize(s) { return path.normalize(s).replace(/\\/g, '/'); } -// Convert relative to absolute path -// dir: directory parent of the file currently in rendering process -// outdir: directory parent from the html output +/** + Convert relative to absolute path + + @param {String} href + @param {String} dir: directory parent of the file currently in rendering process + @param {String} outdir: directory parent from the html output + @return {String} +*/ function toAbsolute(_href, dir, outdir) { if (isExternal(_href)) return _href; outdir = outdir == undefined? dir : outdir; @@ -54,8 +59,14 @@ function toAbsolute(_href, dir, outdir) { return _href; } -// Convert an absolute path to a relative path for a specific folder (dir) -// ('test/', 'hello.md') -> '../hello.md' +/** + Convert an absolute path to a relative path for a specific folder (dir) + ('test/', 'hello.md') -> '../hello.md' + + @param {String} dir: current directory + @param {String} file: absolute path of file + @return {String} +*/ function relative(dir, file) { return normalize(path.relative(dir, file)); } |