diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-10-20 23:40:19 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-10-20 23:40:19 +0100 |
| commit | f1f833367bb0f52d8895fa72da06daa700f574e2 (patch) | |
| tree | bf8e9613172c0644f6a754261c3c98e4ef6254f6 /lib | |
| parent | 242e863ad222342627a69d03ee68e5bd60ed4920 (diff) | |
Convert document tabs into literal tab characters
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/document-to-html.js | 4 | ||||
| -rw-r--r-- | lib/documents.js | 7 |
2 files changed, 11 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; |
