pptxtojson 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -661
- package/README.md +169 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/align.js +43 -14
- package/src/fill.js +10 -1
- package/src/fontStyle.js +3 -3
- package/src/position.js +4 -4
- package/src/pptxtojson.js +137 -95
- package/src/shadow.js +5 -4
- package/src/text.js +10 -11
package/src/text.js
CHANGED
|
@@ -14,11 +14,10 @@ import {
|
|
|
14
14
|
getFontShadow,
|
|
15
15
|
} from './fontStyle'
|
|
16
16
|
|
|
17
|
-
export function genTextBody(textBodyNode,
|
|
17
|
+
export function genTextBody(textBodyNode, spNode, slideLayoutSpNode, type, warpObj) {
|
|
18
18
|
if (!textBodyNode) return ''
|
|
19
19
|
|
|
20
20
|
let text = ''
|
|
21
|
-
const slideMasterTextStyles = warpObj['slideMasterTextStyles']
|
|
22
21
|
|
|
23
22
|
const pNode = textBodyNode['a:p']
|
|
24
23
|
const pNodes = pNode.constructor === Array ? pNode : [pNode]
|
|
@@ -49,7 +48,7 @@ export function genTextBody(textBodyNode, slideLayoutSpNode, slideMasterSpNode,
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
const align = getHorizontalAlign(pNode,
|
|
51
|
+
const align = getHorizontalAlign(pNode, spNode, type, warpObj)
|
|
53
52
|
|
|
54
53
|
const listType = getListType(pNode)
|
|
55
54
|
if (listType) {
|
|
@@ -72,10 +71,10 @@ export function genTextBody(textBodyNode, slideLayoutSpNode, slideMasterSpNode,
|
|
|
72
71
|
text += `<p style="text-align: ${align};">`
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
if (!rNode) text += genSpanElement(pNode, slideLayoutSpNode, type, warpObj
|
|
74
|
+
if (!rNode) text += genSpanElement(pNode, slideLayoutSpNode, type, warpObj)
|
|
76
75
|
else {
|
|
77
76
|
for (const rNodeItem of rNode) {
|
|
78
|
-
text += genSpanElement(rNodeItem, slideLayoutSpNode, type, warpObj
|
|
77
|
+
text += genSpanElement(rNodeItem, slideLayoutSpNode, type, warpObj)
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
@@ -95,7 +94,7 @@ export function getListType(node) {
|
|
|
95
94
|
return ''
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
export function genSpanElement(node, slideLayoutSpNode, type, warpObj
|
|
97
|
+
export function genSpanElement(node, slideLayoutSpNode, type, warpObj) {
|
|
99
98
|
const slideMasterTextStyles = warpObj['slideMasterTextStyles']
|
|
100
99
|
|
|
101
100
|
let text = node['a:t']
|
|
@@ -104,14 +103,14 @@ export function genSpanElement(node, slideLayoutSpNode, type, warpObj, fontsizeF
|
|
|
104
103
|
|
|
105
104
|
let styleText = ''
|
|
106
105
|
const fontColor = getFontColor(node)
|
|
107
|
-
const fontSize = getFontSize(node, slideLayoutSpNode, type, slideMasterTextStyles, fontsizeFactor)
|
|
106
|
+
const fontSize = getFontSize(node, slideLayoutSpNode, type, slideMasterTextStyles, warpObj.options.fontsizeFactor)
|
|
108
107
|
const fontType = getFontType(node, type, warpObj)
|
|
109
108
|
const fontBold = getFontBold(node)
|
|
110
109
|
const fontItalic = getFontItalic(node)
|
|
111
110
|
const fontDecoration = getFontDecoration(node)
|
|
112
111
|
const fontDecorationLine = getFontDecorationLine(node)
|
|
113
|
-
const fontSpace = getFontSpace(node, fontsizeFactor)
|
|
114
|
-
const shadow = getFontShadow(node, warpObj
|
|
112
|
+
const fontSpace = getFontSpace(node, warpObj.options.fontsizeFactor)
|
|
113
|
+
const shadow = getFontShadow(node, warpObj)
|
|
115
114
|
const subscript = getFontSubscript(node)
|
|
116
115
|
|
|
117
116
|
if (fontColor) styleText += `color: ${fontColor};`
|
|
@@ -128,7 +127,7 @@ export function genSpanElement(node, slideLayoutSpNode, type, warpObj, fontsizeF
|
|
|
128
127
|
const linkID = getTextByPathList(node, ['a:rPr', 'a:hlinkClick', 'attrs', 'r:id'])
|
|
129
128
|
if (linkID) {
|
|
130
129
|
const linkURL = warpObj['slideResObj'][linkID]['target']
|
|
131
|
-
return `<span style="${styleText}"><a href="${linkURL}" target="_blank">${text.replace(/\s/
|
|
130
|
+
return `<span style="${styleText}"><a href="${linkURL}" target="_blank">${text.replace(/\t/g, ' ').replace(/\s/g, ' ')}</a></span>`
|
|
132
131
|
}
|
|
133
|
-
return `<span style="${styleText}">${text.replace(/\s/
|
|
132
|
+
return `<span style="${styleText}">${text.replace(/\t/g, ' ').replace(/\s/g, ' ')}</span>`
|
|
134
133
|
}
|