diff options
Diffstat (limited to 'lib/models')
-rw-r--r-- | lib/models/file.js | 14 | ||||
-rw-r--r-- | lib/models/page.js | 9 | ||||
-rw-r--r-- | lib/models/summaryArticle.js | 9 |
3 files changed, 31 insertions, 1 deletions
diff --git a/lib/models/file.js b/lib/models/file.js index ebfe629..b6b06ee 100644 --- a/lib/models/file.js +++ b/lib/models/file.js @@ -20,6 +20,20 @@ File.prototype.getMTime = function() { }; /** + Return type of file ('markdown' or 'asciidoc') + + @return {String} +*/ +File.prototype.getType = function() { + var parser = this.getParser(); + if (parser) { + return parser.name; + } else { + return undefined; + } +}; + +/** Return extension of this file (lowercased) @return {String} diff --git a/lib/models/page.js b/lib/models/page.js index 1ac0d50..0a9cf38 100644 --- a/lib/models/page.js +++ b/lib/models/page.js @@ -9,7 +9,10 @@ var Page = Immutable.Record({ attributes: Immutable.Map(), // Content of the page - content: String() + content: String(), + + // Direction of the text + dir: String('ltr') }); Page.prototype.getFile = function() { @@ -24,6 +27,10 @@ Page.prototype.getContent = function() { return this.get('content'); }; +Page.prototype.getDir = function() { + return this.get('dir'); +}; + /** Create a page for a file diff --git a/lib/models/summaryArticle.js b/lib/models/summaryArticle.js index 4a448c8..e3d85ef 100644 --- a/lib/models/summaryArticle.js +++ b/lib/models/summaryArticle.js @@ -30,6 +30,15 @@ SummaryArticle.prototype.getArticles = function() { }; /** + Return how deep the article is + + @return {Number} +*/ +SummaryArticle.prototype.getDepth = function() { + return this.getLevel().split('.').length; +}; + +/** Return an article by its level @param {String} level |