aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/document-to-html.js4
-rw-r--r--lib/documents.js7
-rw-r--r--tests/document-to-html.tests.js8
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index 5c4db50..b34f951 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -117,6 +117,10 @@ function DocumentConverter(options) {
html.text(element.value);
callback();
},
+ "tab": function(element, html, messages, callback) {
+ html.text("\t");
+ callback();
+ },
"hyperlink": function(element, html, messages, callback) {
html.open(htmlPaths.element("a", {href: element.href}));
convertElements(element.children, html, messages, function(err) {
diff --git a/lib/documents.js b/lib/documents.js
index 5f64059..4dfbe74 100644
--- a/lib/documents.js
+++ b/lib/documents.js
@@ -33,6 +33,12 @@ function Text(value) {
};
}
+function Tab(value) {
+ return {
+ type: "tab"
+ };
+}
+
function Hyperlink(children, options) {
return {
type: "hyperlink",
@@ -64,5 +70,6 @@ exports.Document = Document;
exports.Paragraph = Paragraph;
exports.Run = Run;
exports.Text = Text;
+exports.Tab = Tab;
exports.Hyperlink = Hyperlink;
exports.Image = Image;
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js
index fd6ef1a..51e1a73 100644
--- a/tests/document-to-html.tests.js
+++ b/tests/document-to-html.tests.js
@@ -184,6 +184,14 @@ describe('DocumentConverter', function() {
});
});
+ test('docx tab is converted to tab in HTML', function() {
+ var tab = new documents.Tab();
+ var converter = new DocumentConverter();
+ return converter.convertToHtml(tab).then(function(result) {
+ assert.equal(result.value, "\t");
+ });
+ });
+
test('images are written with data URIs', function() {
var imageBuffer = new Buffer("Not an image at all!");
var image = new documents.Image({