commonform-docx 9.1.1 → 9.3.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/lint.log +4 -0
- package/outdated.log +0 -2
- package/package.json +1 -1
- package/templates/hyperlink.js +6 -0
- package/templates/paragraph.js +2 -2
- package/templates/run.js +2 -1
- package/test.log +98 -0
package/lint.log
ADDED
package/outdated.log
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commonform-docx",
|
|
3
3
|
"description": "render Common Forms in Office Open XML (Microsoft Word .docx format)",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.3.0",
|
|
5
5
|
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (http://kemitchell.com)",
|
|
6
6
|
"bin": "bin.js",
|
|
7
7
|
"dependencies": {
|
package/templates/paragraph.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const escape = require('../escape')
|
|
2
2
|
const has = require('has')
|
|
3
|
+
const hyperlink = require('./hyperlink')
|
|
3
4
|
const numberToWords = require('number-to-words-en')
|
|
4
5
|
const run = require('./run')
|
|
5
6
|
const tag = require('./tag')
|
|
@@ -113,8 +114,7 @@ module.exports = (element, options) => {
|
|
|
113
114
|
function componentReference (component, meta) {
|
|
114
115
|
const href = component.component + '/' + component.version
|
|
115
116
|
const returned = [makeRun(options.incorporateComponentText + ' ')]
|
|
116
|
-
const
|
|
117
|
-
const link = '<w:hyperlink r:id="' + rId + '" w:history="1"><w:r><w:rPr><w:color w:val="0000EE"/><w:u w:val="single"/></w:rPr><w:t>' + escape(href) + '</w:t></w:r></w:hyperlink>'
|
|
117
|
+
const link = hyperlink(options, href)
|
|
118
118
|
if (meta) {
|
|
119
119
|
returned.push(
|
|
120
120
|
makeRun(meta.publisher + ' ' + meta.name + ' Version ' + meta.version + ' ('),
|
package/templates/run.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const escape = require('../escape')
|
|
2
2
|
const has = require('has')
|
|
3
|
+
const hyperlink = require('./hyperlink')
|
|
3
4
|
const tag = require('./tag')
|
|
4
5
|
|
|
5
6
|
const defaults = {
|
|
@@ -84,7 +85,7 @@ module.exports = function run (element, conspicuous, options) {
|
|
|
84
85
|
)
|
|
85
86
|
}
|
|
86
87
|
} else if (has(element, 'link')) {
|
|
87
|
-
|
|
88
|
+
return hyperlink(options, element.link)
|
|
88
89
|
} else {
|
|
89
90
|
throw new Error('Invalid type: ' + JSON.stringify(element, null, 2))
|
|
90
91
|
}
|
package/test.log
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
> commonform-docx@9.2.0 pretest
|
|
3
|
+
> npm run prepublishOnly
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> commonform-docx@9.2.0 prepublishOnly
|
|
7
|
+
> node build/scaffold.js data/scaffold.docx > data/scaffold.json
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
> commonform-docx@9.2.0 test
|
|
11
|
+
> tape test.js
|
|
12
|
+
|
|
13
|
+
TAP version 13
|
|
14
|
+
# renders text
|
|
15
|
+
ok 1 no render error
|
|
16
|
+
ok 2 no textract error
|
|
17
|
+
ok 3 text appears in output
|
|
18
|
+
# renders definitions
|
|
19
|
+
ok 4 no render error
|
|
20
|
+
ok 5 no textract error
|
|
21
|
+
ok 6 defined term appears in output
|
|
22
|
+
# renders uses
|
|
23
|
+
ok 7 no render error
|
|
24
|
+
ok 8 no textract error
|
|
25
|
+
ok 9 term appears in output
|
|
26
|
+
# renders references
|
|
27
|
+
ok 10 no render error
|
|
28
|
+
ok 11 no textract error
|
|
29
|
+
ok 12 reference appears in output
|
|
30
|
+
# handles components without headings
|
|
31
|
+
ok 13 no render error
|
|
32
|
+
# handles components with substitutions
|
|
33
|
+
ok 14 no render error
|
|
34
|
+
# omits period after heading ending w/ period
|
|
35
|
+
ok 15 no render error
|
|
36
|
+
ok 16 no textract error
|
|
37
|
+
ok 17 double period does not appear in output
|
|
38
|
+
# adds space between heading and defined term
|
|
39
|
+
ok 18 no render error
|
|
40
|
+
ok 19 no textract error
|
|
41
|
+
ok 20 space between heading and term
|
|
42
|
+
# adds space between heading and text
|
|
43
|
+
ok 21 no render error
|
|
44
|
+
ok 22 no textract error
|
|
45
|
+
ok 23 space between heading and text
|
|
46
|
+
# renders broken references
|
|
47
|
+
ok 24 no render error
|
|
48
|
+
ok 25 no textract error
|
|
49
|
+
ok 26 reference appears in output
|
|
50
|
+
# fills blanks
|
|
51
|
+
ok 27 no render error
|
|
52
|
+
ok 28 no textract error
|
|
53
|
+
ok 29 value appears in output
|
|
54
|
+
# custom blank text
|
|
55
|
+
ok 30 no render error
|
|
56
|
+
ok 31 no textract error
|
|
57
|
+
ok 32 value appears in output
|
|
58
|
+
# renders empty blank placeholders
|
|
59
|
+
ok 33 no render error
|
|
60
|
+
ok 34 no textract error
|
|
61
|
+
ok 35 placeholder appears in output
|
|
62
|
+
# renders custom empty blank placeholders
|
|
63
|
+
ok 36 no render error
|
|
64
|
+
ok 37 no textract error
|
|
65
|
+
ok 38 placeholder appears in output
|
|
66
|
+
# renders custom empty blank placeholders
|
|
67
|
+
ok 39 no render error
|
|
68
|
+
ok 40 no textract error
|
|
69
|
+
ok 41 placeholder appears in output
|
|
70
|
+
# renders conspicuous text
|
|
71
|
+
ok 42 no render error
|
|
72
|
+
ok 43 no textract error
|
|
73
|
+
ok 44 conspicuous text appears in output
|
|
74
|
+
# renders titles
|
|
75
|
+
ok 45 no render error
|
|
76
|
+
ok 46 no textract error
|
|
77
|
+
ok 47 title appears in output
|
|
78
|
+
# renders centered titles
|
|
79
|
+
ok 48 no render error
|
|
80
|
+
ok 49 no textract error
|
|
81
|
+
ok 50 title appears in output
|
|
82
|
+
# renders versions
|
|
83
|
+
ok 51 no render error
|
|
84
|
+
ok 52 no textract error
|
|
85
|
+
ok 53 version appears in output
|
|
86
|
+
# renders hashes
|
|
87
|
+
ok 54 no render error
|
|
88
|
+
ok 55 no textract error
|
|
89
|
+
ok 56 hash symbol appears in output
|
|
90
|
+
# throws for invalid content
|
|
91
|
+
ok 57 throw an error
|
|
92
|
+
|
|
93
|
+
1..57
|
|
94
|
+
# tests 57
|
|
95
|
+
# pass 57
|
|
96
|
+
|
|
97
|
+
# ok
|
|
98
|
+
|