Skip to content

Commit

Permalink
removing html parsing logic as no longer required and was stripping o…
Browse files Browse the repository at this point in the history
…ut content
  • Loading branch information
hudajkhan committed Dec 5, 2024
1 parent 8fc96b7 commit fe3724e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/assets/javascripts/bibliography.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@
if (index > toggleIndex && total > toggleThreshold) {
elClass += ' hide-bibliography';
}
var parsedHtml = $.map($.parseHTML($.parseHTML(bibEntry.attributes.formatted_bibliography_ts.attributes.value)[0].textContent), function(value) {
// If it is HTML, return that, if not just return the text
if (value.outerHTML) {
return value.outerHTML;
}
return value.textContent;
}).join('');

// This string contains the formatted bibliography for this item.
// This string can contain HTML elements as well which should be displayed correctly.
var formatted_bibliography = bibEntry.attributes.formatted_bibliography_ts.attributes.value;

return '<p class="' + elClass + '">' +
parsedHtml +
formatted_bibliography +
' <a href="' + bibEntry.links.self + '">' +
'[View full reference]' +
'</a>' +
Expand Down

0 comments on commit fe3724e

Please sign in to comment.