1
1
import lodash from "lodash"
2
2
import { type DocumentOptions } from "./types.ts"
3
3
4
- const applicationName = "html-to-docx"
5
- const defaultOrientation = "portrait"
6
- const landscapeWidth = 15840
7
- const landscapeHeight = 12240
8
- const landscapeMargins = {
4
+ export const applicationName = "html-to-docx"
5
+ export const defaultOrientation = "portrait"
6
+ export const landscapeWidth = 15840
7
+ export const landscapeHeight = 12240
8
+ export const landscapeMargins = {
9
9
top : 1800 ,
10
10
right : 1440 ,
11
11
bottom : 1800 ,
@@ -14,7 +14,7 @@ const landscapeMargins = {
14
14
footer : 720 ,
15
15
gutter : 0 ,
16
16
}
17
- const portraitMargins = {
17
+ export const portraitMargins = {
18
18
top : 1440 ,
19
19
right : 1800 ,
20
20
bottom : 1440 ,
@@ -23,10 +23,10 @@ const portraitMargins = {
23
23
footer : 720 ,
24
24
gutter : 0 ,
25
25
}
26
- const defaultFont = "Times New Roman"
27
- const defaultFontSize = 22
28
- const defaultLang = "en-US"
29
- const defaultDocumentOptions : DocumentOptions = {
26
+ export const defaultFont = "Times New Roman"
27
+ export const defaultFontSize = 22
28
+ export const defaultLang = "en-US"
29
+ export const defaultDocumentOptions : DocumentOptions = {
30
30
orientation : defaultOrientation ,
31
31
margins : lodash . cloneDeep ( portraitMargins ) ,
32
32
creator : applicationName ,
@@ -41,21 +41,21 @@ const defaultDocumentOptions: DocumentOptions = {
41
41
} ,
42
42
defaultLang,
43
43
}
44
- const defaultHTMLString = "<p></p>"
45
- const relsFolderName = "_rels"
46
- const headerFileName = "header1"
47
- const footerFileName = "footer1"
48
- const themeFileName = "theme1"
49
- const documentFileName = "document"
50
- const headerType = "header"
51
- const footerType = "footer"
52
- const themeType = "theme"
53
- const hyperlinkType = "hyperlink"
54
- const imageType = "image"
55
- const internalRelationship = "Internal"
56
- const wordFolder = "word"
57
- const themeFolder = "theme"
58
- const paragraphBordersObject = {
44
+ export const defaultHTMLString = "<p></p>"
45
+ export const relsFolderName = "_rels"
46
+ export const headerFileName = "header1"
47
+ export const footerFileName = "footer1"
48
+ export const themeFileName = "theme1"
49
+ export const documentFileName = "document"
50
+ export const headerType = "header"
51
+ export const footerType = "footer"
52
+ export const themeType = "theme"
53
+ export const hyperlinkType = "hyperlink"
54
+ export const imageType = "image"
55
+ export const internalRelationship = "Internal"
56
+ export const wordFolder = "word"
57
+ export const themeFolder = "theme"
58
+ export const paragraphBordersObject = {
59
59
top : {
60
60
size : 0 ,
61
61
spacing : 3 ,
@@ -77,35 +77,75 @@ const paragraphBordersObject = {
77
77
color : "FFFFFF" ,
78
78
} ,
79
79
}
80
- const colorlessColors = [ "transparent" , "auto" ]
81
- const verticalAlignValues = [ "top" , "middle" , "bottom" ]
80
+ export const colorlessColors = [ "transparent" , "auto" ]
81
+ export const verticalAlignValues = [ "top" , "middle" , "bottom" ]
82
82
83
- export {
84
- applicationName ,
85
- colorlessColors ,
86
- defaultDocumentOptions ,
87
- defaultFont ,
88
- defaultFontSize ,
89
- defaultHTMLString ,
90
- defaultLang ,
91
- defaultOrientation ,
92
- documentFileName ,
93
- footerFileName ,
94
- footerType ,
95
- headerFileName ,
96
- headerType ,
97
- hyperlinkType ,
98
- imageType ,
99
- internalRelationship ,
100
- landscapeHeight ,
101
- landscapeMargins ,
102
- landscapeWidth ,
103
- paragraphBordersObject ,
104
- portraitMargins ,
105
- relsFolderName ,
106
- themeFileName ,
107
- themeFolder ,
108
- themeType ,
109
- verticalAlignValues ,
110
- wordFolder ,
111
- }
83
+ export const htmlInlineElements = [
84
+ "a" ,
85
+ "abbr" ,
86
+ "acronym" ,
87
+ "b" ,
88
+ "bdo" ,
89
+ "big" ,
90
+ "br" ,
91
+ "button" ,
92
+ "cite" ,
93
+ "code" ,
94
+ "dfn" ,
95
+ "em" ,
96
+ "i" ,
97
+ "img" ,
98
+ "input" ,
99
+ "kbd" ,
100
+ "label" ,
101
+ "map" ,
102
+ "object" ,
103
+ "output" ,
104
+ "q" ,
105
+ "samp" ,
106
+ "script" ,
107
+ "select" ,
108
+ "small" ,
109
+ "span" ,
110
+ "strong" ,
111
+ "sub" ,
112
+ "sup" ,
113
+ "textarea" ,
114
+ "time" ,
115
+ "tt" ,
116
+ "var" ,
117
+ ]
118
+
119
+ export const htmlHeadings = [ "h1" , "h2" , "h3" , "h4" , "h5" , "h6" ]
120
+
121
+ // export const htmlBlockElements = [
122
+ // "address",
123
+ // "article",
124
+ // "aside",
125
+ // "blockquote",
126
+ // "canvas",
127
+ // "dd",
128
+ // "div",
129
+ // "dl",
130
+ // "dt",
131
+ // "fieldset",
132
+ // "figcaption",
133
+ // "figure",
134
+ // "footer",
135
+ // "form",
136
+ // "header",
137
+ // ...htmlHeadings,
138
+ // "hr",
139
+ // "li",
140
+ // "main",
141
+ // "nav",
142
+ // "noscript",
143
+ // "ol",
144
+ // "p",
145
+ // "pre",
146
+ // "section",
147
+ // "table",
148
+ // "tfoot",
149
+ // "ul",
150
+ // "video",
151
+ // ]
0 commit comments