diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:34:34 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:34:34 +0100 |
| commit | c1a3e929b7268f14619daf3eff0085a747703f7e (patch) | |
| tree | 05b686b62e61d55ac2faebe49fe132d4757eeefb /lib | |
| parent | 87105c192933b043a04b1ff00abd575805bb3c65 (diff) | |
Remove properties attribute from Run
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/document-to-html.js | 8 | ||||
| -rw-r--r-- | lib/documents.js | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index a2d7030..1fce576 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -51,16 +51,16 @@ function DocumentConverter(options) { function convertRun(run, html) { var runHtml = new HtmlGenerator(); - if (run.properties.styleName) { - var style = runStyleMap[run.properties.styleName]; + if (run.styleName) { + var style = runStyleMap[run.styleName]; if (style) { runHtml.style(style); } } - if (run.properties.isBold) { + if (run.isBold) { runHtml.push(styles.element("strong")); } - if (run.properties.isItalic) { + if (run.isItalic) { runHtml.push(styles.element("em")); } return convertElements(run.children, runHtml) diff --git a/lib/documents.js b/lib/documents.js index e4f0ef7..f1ce08b 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -5,8 +5,6 @@ function Document(children) { }; } -Run = ElementWithChildren("run"); - function Paragraph(children, properties) { properties = properties || {}; return { @@ -16,6 +14,17 @@ function Paragraph(children, properties) { }; } +function Run(children, properties) { + properties = properties || {}; + return { + type: "run", + children: children, + styleName: properties.styleName, + isBold: properties.isBold, + isItalic: properties.isItalic + }; +} + function Text(value) { return { type: "text", |
