w-docx-split 1.0.0
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/.editorconfig +9 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +55 -0
- package/.jsdoc +25 -0
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/SECURITY.md +5 -0
- package/babel.config.js +16 -0
- package/dist/w-docx-split.umd.js +7 -0
- package/dist/w-docx-split.umd.js.map +1 -0
- package/docs/WDocxSplit.mjs.html +199 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/global.html +519 -0
- package/docs/index.html +84 -0
- package/docs/scripts/collapse.js +39 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +99 -0
- package/docs/styles/jsdoc.css +776 -0
- package/docs/styles/prettify.css +80 -0
- package/g.mjs +29 -0
- package/package.json +32 -0
- package/script.txt +17 -0
- package/scripts/install.mjs +30 -0
- package/src/WDocxSplit.mjs +127 -0
- package/src/downloadFiles.mjs +23 -0
- package/srcPython/build.bat +9 -0
- package/srcPython/run.bat +4 -0
- package/srcPython/splitDocx.py +271 -0
- package/srcPython/splitDocx.spec +37 -0
- package/srcPython//350/252/252/346/230/216.txt +24 -0
- package/test/WDocxSplit.test.mjs +40 -0
- package/test/docin.docx +0 -0
- package/test/outTrue/001.docx +0 -0
- package/test/outTrue/002.docx +0 -0
- package/toolg/addVersion.mjs +4 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/gDistRollup.mjs +28 -0
- package/toolg/modifyReadme.mjs +4 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import w from 'wsemi'
|
|
3
|
+
import assert from 'assert'
|
|
4
|
+
import WDocxSplit from '../src/WDocxSplit.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function isWindows() {
|
|
8
|
+
return process.platform === 'win32'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
describe('WDocxSplit', function() {
|
|
13
|
+
|
|
14
|
+
//check
|
|
15
|
+
if (!isWindows()) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let fpOut = `./test/out/001.docx`
|
|
20
|
+
let fpOutTrue = `./test/outTrue/001.docx`
|
|
21
|
+
|
|
22
|
+
let fpIn = `./test/docin.docx`
|
|
23
|
+
let strSep = '[systag:sepline]'
|
|
24
|
+
let fdOut = `./test/out`
|
|
25
|
+
let opt = {
|
|
26
|
+
padZero: 3,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it('convert', async function() {
|
|
30
|
+
await WDocxSplit(fpIn, strSep, fdOut, opt)
|
|
31
|
+
let r = (fs.statSync(fpOut)).size
|
|
32
|
+
let rr = (fs.statSync(fpOutTrue)).size
|
|
33
|
+
//轉出docx檔案每次不同, 改用門檻比對
|
|
34
|
+
// console.log('r', r, 'rr', rr)
|
|
35
|
+
let b = r > 12000 && rr > 12000
|
|
36
|
+
w.fsDeleteFolder(fdOut)
|
|
37
|
+
assert.strict.deepEqual(true, b)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
})
|
package/test/docin.docx
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
|
|
2
|
+
import getFiles from 'w-package-tools/src/getFiles.mjs'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
let fdSrc = './src'
|
|
6
|
+
let fdTar = './dist'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
rollupFiles({
|
|
10
|
+
fns: 'WDocxSplit.mjs',
|
|
11
|
+
fdSrc,
|
|
12
|
+
fdTar,
|
|
13
|
+
hookNameDist: () => 'w-docx-split',
|
|
14
|
+
// nameDistType: 'kebabCase', //直接由hookNameDist給予
|
|
15
|
+
globals: {
|
|
16
|
+
'path': 'path',
|
|
17
|
+
'fs': 'fs',
|
|
18
|
+
'process': 'process',
|
|
19
|
+
'child_process': 'child_process',
|
|
20
|
+
},
|
|
21
|
+
external: [
|
|
22
|
+
'path',
|
|
23
|
+
'fs',
|
|
24
|
+
'process',
|
|
25
|
+
'child_process',
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|