Skip to content

Commit

Permalink
For the Ladybird report strip any HTML/EAD tags from titles and also …
Browse files Browse the repository at this point in the history
…include the series' component id in the breadcrumb
  • Loading branch information
payten committed May 18, 2017
1 parent d56c69f commit e05649f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions backend/model/ladybird_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit e05649f

Please sign in to comment.