From e05649fd1591ee84cd2037172d31270e721bd787 Mon Sep 17 00:00:00 2001 From: Payten Giles Date: Thu, 18 May 2017 10:48:52 +1000 Subject: [PATCH] For the Ladybird report strip any HTML/EAD tags from titles and also include the series' component id in the breadcrumb --- backend/model/ladybird_export.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/model/ladybird_export.rb b/backend/model/ladybird_export.rb index 4203653..d61a6d9 100644 --- a/backend/model/ladybird_export.rb +++ b/backend/model/ladybird_export.rb @@ -158,13 +158,10 @@ def breadcrumb_for_archival_object(id) # Only include "Series X" if the component unique identifier has been # filled out in ASpace (otherwise, just include the title) if ao.fetch('level') == 'series' && !ao.fetch('component_id', nil).nil? - # only prepend title with "Series" (if not already there) - unless display_string.start_with?('Series') - display_string = "Series #{display_string}" - end + display_string = "Series #{ao.fetch('component_id')} #{display_string}" end - display_string + strip_html(display_string) }.join('. ') end @@ -551,7 +548,7 @@ def host_creator(row) end def host_title(row) - row[:resource_title] + strip_html(row[:resource_title]) end def host_note(row) @@ -584,7 +581,7 @@ def abstract(row) end def title(row) - row[:archival_object_title] + strip_html(row[:archival_object_title]) end def creator(row) @@ -690,4 +687,10 @@ def all_years(row) .join(NEW_LINE_SEPARATOR) end + def strip_html(string) + return if string.nil? + + string.gsub(/<\/?[^>]*>/, "") + end + end \ No newline at end of file