Skip to content

Commit 06610e5

Browse files
author
Alexandra Shubenko
committed
quote marks fixes in custom_title
1 parent 878ead2 commit 06610e5

3 files changed

Lines changed: 23 additions & 43 deletions

File tree

vis/js/templates/modals/CitationModal.jsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { formatString, removeEmbedParam } from "../../utils/string";
1111
import CopyButton from "../CopyButton";
1212
import useMatomo from "../../utils/useMatomo";
1313
import { queryConcatenator } from "../../utils/data";
14+
import {unescapeHTML} from "../../utils/unescapeHTMLentities.js";
1415

1516
const CitationModal = ({
1617
open,
@@ -38,7 +39,6 @@ const CitationModal = ({
3839
customQuery = customQuery.substr(0, 100) + "[..]";
3940
}
4041
if (customTitle) {
41-
// customQuery = customTitle;
4242
customQuery = unescapeHTML(customTitle);
4343
}
4444

@@ -100,25 +100,4 @@ const mapDispatchToProps = (dispatch) => ({
100100
onClose: () => dispatch(closeCitationModal()),
101101
});
102102

103-
const unescapeHTML = (string) => {
104-
let entityMap = {
105-
"&": "&",
106-
"&lt;": "<",
107-
"&gt;": ">",
108-
"&quot;": '"',
109-
"&#34;": '"',
110-
"&#39;": "'",
111-
"&#x2F;": "/",
112-
"&#x60;": "`",
113-
"&#x3D;": "=",
114-
};
115-
116-
return String(string).replace(
117-
/(&amp;|&lt;|&gt;|&quot;|&#34;|&#39;|&#x2F;|&#x60;|&#x3D;)/g,
118-
function (s) {
119-
return entityMap[s];
120-
}
121-
);
122-
};
123-
124103
export default connect(mapStateToProps, mapDispatchToProps)(CitationModal);

vis/js/templates/modals/infomodal/subcomponents/StandardKMInfo.jsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Modal } from "react-bootstrap";
44
import AboutSoftware from "./AboutSoftware";
55
import DataSource from "./DataSource";
66
import { queryConcatenator } from "../../../../utils/data";
7+
import {unescapeHTML} from "../../../../utils/unescapeHTMLentities.js";
8+
79

810

911
const StandardKMInfo = ({
@@ -91,25 +93,4 @@ const StandardKMInfo = ({
9193
);
9294
};
9395

94-
const unescapeHTML = (string) => {
95-
let entityMap = {
96-
"&amp;": "&",
97-
"&lt;": "<",
98-
"&gt;": ">",
99-
"&quot;": '"',
100-
"&#34;": '"',
101-
"&#39;": "'",
102-
"&#x2F;": "/",
103-
"&#x60;": "`",
104-
"&#x3D;": "=",
105-
};
106-
107-
return String(string).replace(
108-
/(&amp;|&lt;|&gt;|&quot;|&#34;|&#39;|&#x2F;|&#x60;|&#x3D;)/g,
109-
function (s) {
110-
return entityMap[s];
111-
}
112-
);
113-
};
114-
11596
export default StandardKMInfo;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const unescapeHTML = (string) => {
2+
let entityMap = {
3+
"&amp;": "&",
4+
"&lt;": "<",
5+
"&gt;": ">",
6+
"&quot;": '"',
7+
"&#34;": '"',
8+
"&#39;": "'",
9+
"&#x2F;": "/",
10+
"&#x60;": "`",
11+
"&#x3D;": "=",
12+
};
13+
14+
return String(string).replace(
15+
/(&amp;|&lt;|&gt;|&quot;|&#34;|&#39;|&#x2F;|&#x60;|&#x3D;)/g,
16+
function (s) {
17+
return entityMap[s];
18+
}
19+
);
20+
};

0 commit comments

Comments
 (0)