diff options
Diffstat (limited to 'lib/page')
-rw-r--r-- | lib/page/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index bc12529..d8b5fff 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -1,6 +1,7 @@ var _ = require('lodash'); var path = require('path'); var parsers = require('gitbook-parsers'); +var direction = require('direction'); var error = require('../utils/error'); var pathUtil = require('../utils/path'); @@ -101,6 +102,13 @@ Page.prototype.getContext = function() { var next = article? article.next() : null; var prev = article? article.prev() : null; + // Detect text direction in this page + var dir = this.book.config.get('direction'); + if (!dir) { + dir = direction(this.content); + if (dir == 'neutral') dir = null; + } + return { file: { path: this.path, @@ -112,7 +120,8 @@ Page.prototype.getContext = function() { next: next? next.getContext() : null, previous: prev? prev.getContext() : null, level: article? article.level : null, - content: this.content + content: this.content, + dir: dir } }; }; |