@legalplace/prerenderx 2.3.4 → 2.3.42

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.
@@ -39,6 +39,8 @@ var OptionRender = (function () {
39
39
  }
40
40
  var variables = OutputParser_1.getRelatedVariablesValues(this.id, this.index, outputReference.variables, this.ovc, this.references);
41
41
  var output = OutputParser_1.parseOutputWithVariables(option.meta.output, variables, autonums);
42
+ output = output.replace(/\n/g, '<br />');
43
+ output = output.replace(/<p><\/p>/g, '<p><br /></p>');
42
44
  this.outputs.push(output);
43
45
  }
44
46
  this.renderChildren();
@@ -23,7 +23,9 @@ exports.getRelatedVariablesValues = function (optionId, index, variables, ovc, r
23
23
  return currentValue;
24
24
  return '';
25
25
  });
26
- variablesValues[currentVariableId] = cleanValues.length === 1 ? cleanValues[0] : cleanValues.join(', ');
26
+ var currentVariableValue = cleanValues.length === 1 ? cleanValues[0] : cleanValues.join(', ');
27
+ currentVariableValue = currentVariableValue.replace(/\n/g, '<br />');
28
+ variablesValues[currentVariableId] = currentVariableValue;
27
29
  });
28
30
  return variablesValues;
29
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/prerenderx",
3
- "version": "2.3.4",
3
+ "version": "2.3.42",
4
4
  "description": "PrerenderX",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/prerenderx",
@@ -56,8 +56,15 @@ class OptionRender {
56
56
 
57
57
  // variables
58
58
  const variables = getRelatedVariablesValues(this.id, this.index, outputReference.variables, this.ovc, this.references)
59
+ let output = parseOutputWithVariables(option.meta.output, variables, autonums)
59
60
 
60
- const output = parseOutputWithVariables(option.meta.output, variables, autonums)
61
+ // Replacing \n with line-break
62
+ output = output.replace(/\n/g, '<br />')
63
+
64
+ // Replacing empty paragraphs with line-break
65
+ output = output.replace(/<p><\/p>/g, '<p><br /></p>')
66
+
67
+ // Pushing output
61
68
  this.outputs.push(output)
62
69
  }
63
70
  this.renderChildren()
@@ -36,8 +36,14 @@ export const getRelatedVariablesValues: getRelatedVarsT = (optionId, index, vari
36
36
  return ''
37
37
  })
38
38
 
39
- // Joining multiple variables
40
- variablesValues[currentVariableId] = cleanValues.length === 1 ? cleanValues[0] : cleanValues.join(', ')
39
+ // Joining multiple variables if needed
40
+ let currentVariableValue = cleanValues.length === 1 ? cleanValues[0] : cleanValues.join(', ')
41
+
42
+ // Replacing \n with <br /> tags
43
+ currentVariableValue = currentVariableValue.replace(/\n/g, '<br />')
44
+
45
+ // Setting variable value
46
+ variablesValues[currentVariableId] = currentVariableValue
41
47
  })
42
48
 
43
49
  return variablesValues