summaryrefslogtreecommitdiffstats
path: root/lib/utils/links.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/links.js')
-rw-r--r--lib/utils/links.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/utils/links.js b/lib/utils/links.js
index 9a95824..aa7c241 100644
--- a/lib/utils/links.js
+++ b/lib/utils/links.js
@@ -15,12 +15,22 @@ var isRelative = function(href) {
try {
var parsed = url.parse(href);
- return !!(!parsed.protocol && parsed.path);// && parsed.path[0] != '/';
+ return !!(!parsed.protocol && parsed.path);
} catch(err) {}
return true;
};
+// Return true if the link is an achor
+var isAnchor = function(href) {
+ try {
+ var parsed = url.parse(href);
+ return !!(!parsed.protocol && !parsed.path && parsed.hash);
+ } catch(err) {}
+
+ return false;
+};
+
// Relative to absolute path
// dir: directory parent of the file currently in rendering process
// outdir: directory parent from the html output
@@ -61,6 +71,7 @@ var changeExtension = function(filename, newext) {
};
module.exports = {
+ isAnchor: isAnchor,
isRelative: isRelative,
isExternal: isExternal,
toAbsolute: toAbsolute,