Skip to content

Commit 878ead2

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

2 files changed

Lines changed: 46 additions & 4 deletions

File tree

vis/js/templates/modals/CitationModal.jsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ const CitationModal = ({
3333
);
3434
};
3535

36-
console.log('CitationModal customTitle = ', customTitle)
37-
console.log('CitationModal titleStyle = ', titleStyle)
38-
3936
let customQuery = queryConcatenator([query, q_advanced]);
4037
if (customQuery.length > 100) {
4138
customQuery = customQuery.substr(0, 100) + "[..]";
4239
}
4340
if (customTitle) {
44-
customQuery = customTitle;
41+
// customQuery = customTitle;
42+
customQuery = unescapeHTML(customTitle);
4543
}
4644

4745
const date = getDateFromTimestamp(timestamp);
@@ -102,4 +100,25 @@ const mapDispatchToProps = (dispatch) => ({
102100
onClose: () => dispatch(closeCitationModal()),
103101
});
104102

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+
105124
export default connect(mapStateToProps, mapDispatchToProps)(CitationModal);

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const StandardKMInfo = ({
1414
}) => {
1515
let queryString = queryConcatenator([query, q_advanced])
1616

17+
customTitle = unescapeHTML(customTitle)
18+
1719
return (
1820
// html template starts here
1921
<>
@@ -89,4 +91,25 @@ const StandardKMInfo = ({
8991
);
9092
};
9193

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+
92115
export default StandardKMInfo;

0 commit comments

Comments
 (0)