aboutsummaryrefslogtreecommitdiff
path: root/lib/documents.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-04-09 12:07:21 +0100
committerMichael Williamson <mike@zwobble.org>2014-04-09 12:07:21 +0100
commit0c131afbe82cedeef9815d11428414d6dc663ae7 (patch)
treedec0df48aa9be20c568575d0ae9bc269e3b83097 /lib/documents.js
parent56589f6390459cb7a4aedd1f7e5ce0a518b0f3c7 (diff)
Create types object for document element type labels
Diffstat (limited to 'lib/documents.js')
-rw-r--r--lib/documents.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/documents.js b/lib/documents.js
index 3af5bd5..ce985e9 100644
--- a/lib/documents.js
+++ b/lib/documents.js
@@ -1,6 +1,16 @@
+var types = {
+ document: "document",
+ paragraph: "paragraph",
+ run: "run",
+ text: "text",
+ tab: "tab",
+ hyperlink: "hyperlink",
+ image: "image"
+};
+
function Document(children) {
return {
- type: "document",
+ type: types.document,
children: children
};
}
@@ -8,7 +18,7 @@ function Document(children) {
function Paragraph(children, properties) {
properties = properties || {};
return {
- type: "paragraph",
+ type: types.paragraph,
children: children,
styleName: properties.styleName || null,
numbering: properties.numbering || null,
@@ -19,7 +29,7 @@ function Paragraph(children, properties) {
function Run(children, properties) {
properties = properties || {};
return {
- type: "run",
+ type: types.run,
children: children,
styleName: properties.styleName || null,
isBold: properties.isBold,
@@ -29,20 +39,20 @@ function Run(children, properties) {
function Text(value) {
return {
- type: "text",
+ type: types.text,
value: value
};
}
function Tab(value) {
return {
- type: "tab"
+ type: types.tab
};
}
function Hyperlink(children, options) {
return {
- type: "hyperlink",
+ type: types.hyperlink,
children: children,
href: options.href
};
@@ -60,7 +70,7 @@ function ElementWithChildren(type) {
function Image(options) {
return {
- type: "image",
+ type: types.image,
read: options.readImage,
altText: options.altText,
contentType: options.contentType