summaryrefslogtreecommitdiffstats
path: root/lib/backbone/article.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-28 23:19:39 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-28 23:19:39 +0100
commitea98444dc0a6e59e79408963e1d340d7765ba9f6 (patch)
treeee946c4eebbe2a7cb9c8b572f2921dee859bbc8e /lib/backbone/article.js
parent328c3a7d5141abdeab1488d6de8a47e62ebf48dc (diff)
downloadgitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.zip
gitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.tar.gz
gitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.tar.bz2
Add parsing of summary and tests
Diffstat (limited to 'lib/backbone/article.js')
-rw-r--r--lib/backbone/article.js28
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/backbone/article.js b/lib/backbone/article.js
deleted file mode 100644
index 299df25..0000000
--- a/lib/backbone/article.js
+++ /dev/null
@@ -1,28 +0,0 @@
-var url = require('url');
-var _ = require('lodash');
-
-/*
-An article represent an entry in the Summary.
-It's defined by a title, a reference, and children articles, the reference (ref) can be a filename + anchor (optional)
-
-*/
-
-function Article(title, ref, articles) {
- var parts = url.parse(ref);
-
- this.title = title;
- this.filename = parts.pathname;
- this.anchor = parts.hash;
- this.articles = _.map(articles || [], function(article) {
- if (article instanceof Article) return article;
- return new Article(article.title, article.ref, article.articles);
- });
-}
-
-// Return true if has children
-Article.prototype.hasChildren = function() {
- return this.articles.length > 0;
-};
-
-
-module.exports = Article;