Skip to content

Commit

Permalink
Merge pull request #2676 from sul-dlss/parsebib
Browse files Browse the repository at this point in the history
Ensuring bibliography shows full reference
  • Loading branch information
corylown authored Dec 5, 2024
2 parents b389a8d + fe3724e commit e6c06b4
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 e6c06b4

Please sign in to comment.