summaryrefslogtreecommitdiffstats
path: root/lib/backbone/summary.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backbone/summary.js')
-rw-r--r--lib/backbone/summary.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/backbone/summary.js b/lib/backbone/summary.js
index 5a2f7f2..9c8a38d 100644
--- a/lib/backbone/summary.js
+++ b/lib/backbone/summary.js
@@ -1,6 +1,5 @@
var _ = require('lodash');
var util = require('util');
-var url = require('url');
var location = require('../utils/location');
var error = require('../utils/error');
@@ -32,17 +31,13 @@ function TOCArticle(def, parent) {
// Path can be a relative path or an url, or nothing
this.ref = def.path;
- if (this.ref) {
- var parts = url.parse(this.ref);
+ if (this.ref && !this.isExternal()) {
+ var parts = this.ref.split('#');
+ this.path = (parts.length > 1? parts.slice(0, -1).join('#') : this.ref);
+ this.anchor = (parts.length > 1? '#' + _.last(parts) : null);
- if (!this.isExternal()) {
- var parts = this.ref.split('#');
- this.path = (parts.length > 1? parts.slice(0, -1).join('#') : this.ref);
- this.anchor = (parts.length > 1? '#' + _.last(parts) : null);
-
- // Normalize path to remove ('./', etc)
- this.path = location.normalize(this.path);
- }
+ // Normalize path to remove ('./', etc)
+ this.path = location.normalize(this.path);
}
this.articles = _.map(def.articles || [], function(article) {