summaryrefslogtreecommitdiffstats
path: root/lib/utils
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-23 23:58:08 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-23 23:58:08 +0200
commit927185d95c9875a9b74d176b93669ebdbceecd14 (patch)
tree94c0b9ef45af8d86c8250ed8c86ad2810ac49d79 /lib/utils
parenta3df6c6f0c1068762f9d48cdff97ab5d4c583082 (diff)
downloadgitbook-927185d95c9875a9b74d176b93669ebdbceecd14.zip
gitbook-927185d95c9875a9b74d176b93669ebdbceecd14.tar.gz
gitbook-927185d95c9875a9b74d176b93669ebdbceecd14.tar.bz2
add test for modifier "annotateText"
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/location.js21
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));
}