@opentermsarchive/engine 0.19.0 → 0.20.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.
@@ -1,4 +1,7 @@
1
1
  {
2
+ "services": {
3
+ "declarationsPath": "../declarations/declarations"
4
+ },
2
5
  "recorder": {
3
6
  "versions": {
4
7
  "storage": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://github.com/ambanum/OpenTermsArchive#readme",
6
6
  "bugs": {
@@ -84,9 +84,12 @@ export async function filterHTML({ content, pageDeclaration }) {
84
84
 
85
85
  // clean code from common changing patterns - initially for Windstream
86
86
  domFragment.querySelectorAll('a[href*="/email-protection"]').forEach(node => {
87
- if (node.href.match(/((.*?)\/email-protection#)[0-9a-fA-F]+/gim)) {
88
- node.href = `${node.href.split('#')[0]}#removed`;
89
- }
87
+ const newProtectedLink = webPageDOM.createElement('a');
88
+ const [href] = node.href.split('#');
89
+
90
+ newProtectedLink.href = href;
91
+ newProtectedLink.innerHTML = '[email protected]';
92
+ node.parentNode.replaceChild(newProtectedLink, node);
90
93
  });
91
94
 
92
95
  const markdownContent = transform(domFragment);
@@ -63,6 +63,7 @@ const rawHTMLWithCommonChangingItems = `
63
63
  <p><a id="link3" href="http://absolute.url/link">link 3</a></p>
64
64
  <p><a id="link4" href="">link 4</a></p>
65
65
  <a href="/cdn-cgi/l/email-protection#3b4c52555f484f495e5a56154b49524d5a584215484f5a4f5e565e554f7b4c52555f484f495e5a5615585456">[email&#160;protected]</a>
66
+ <p><a href="/cdn-cgi/l/email-protection#2d4e4243594c4e596d4e4459545e4e424259034858">conta<span>[email&#160;protected]</span></a></p>
66
67
  </body>
67
68
  </html>`;
68
69
 
@@ -78,7 +79,9 @@ const expectedFilteredWithCommonChangingItems = `Title
78
79
 
79
80
  link 4
80
81
 
81
- [\\[email protected\\]](https://exemple.com/cdn-cgi/l/email-protection#removed)`;
82
+ [\\[email protected\\]](https://exemple.com/cdn-cgi/l/email-protection)
83
+
84
+ [\\[email protected\\]](https://exemple.com/cdn-cgi/l/email-protection)`;
82
85
  /* eslint-enable no-irregular-whitespace */
83
86
 
84
87
  const additionalFilter = {