commonform-docx 9.2.0 → 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/outdated.log ADDED
File without changes
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.2.0",
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": {
@@ -0,0 +1,6 @@
1
+ const escape = require('../escape')
2
+
3
+ module.exports = (options, url) => {
4
+ const rId = options.rIdForHREF(url)
5
+ return `<w:hyperlink r:id="${rId}"><w:r><w:rPr><w:color w:val="0000EE"/><w:u w:val="single"/></w:rPr><w:t>${escape(url)}</w:t></w:r></w:hyperlink>`
6
+ }
@@ -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 rId = options.rIdForHREF(href)
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,9 +85,7 @@ module.exports = function run (element, conspicuous, options) {
84
85
  )
85
86
  }
86
87
  } else if (has(element, 'link')) {
87
- const url = element.link
88
- const rId = options.rIdForHREF(url)
89
- return '<w:hyperlink r:id="' + rId + '"><w:r><w:rPr><w:rStyle w:val="Hyperlink"/></w:rPr><w:t>' + escape(url) + '</w:t></w:r></w:hyperlink>'
88
+ return hyperlink(options, element.link)
90
89
  } else {
91
90
  throw new Error('Invalid type: ' + JSON.stringify(element, null, 2))
92
91
  }
package/test.log CHANGED
@@ -1,13 +1,13 @@
1
1
 
2
- > commonform-docx@9.1.1 pretest
2
+ > commonform-docx@9.2.0 pretest
3
3
  > npm run prepublishOnly
4
4
 
5
5
 
6
- > commonform-docx@9.1.1 prepublishOnly
6
+ > commonform-docx@9.2.0 prepublishOnly
7
7
  > node build/scaffold.js data/scaffold.docx > data/scaffold.json
8
8
 
9
9
 
10
- > commonform-docx@9.1.1 test
10
+ > commonform-docx@9.2.0 test
11
11
  > tape test.js
12
12
 
13
13
  TAP version 13