Skip to content

Commit 4f7b4d8

Browse files
committed
Wrap EAD abstract in HTML tag
1 parent 1e9ba42 commit 4f7b4d8

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

app/models/concerns/arclight/solr_document.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ def extent
6565
end
6666

6767
def abstract_or_scope
68-
first('abstract_ssm') || first('scopecontent_ssm')
68+
if first('abstract_ssm')
69+
# EAD <abstract> may contain raw #PCDATA not wrapped in an HTML tag
70+
"<p>#{first('abstract_ssm')}</p>"
71+
else
72+
first('scopecontent_ssm')
73+
end
6974
end
7075

7176
def creator

spec/models/concerns/arclight/solr_document_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@
4141
end
4242
end
4343

44+
describe '#abstract_or_scope' do
45+
let(:document) do
46+
SolrDocument.new(abstract_ssm: 'I will be wrapped', scopecontent_ssm: '<p>I am wrapped</p>')
47+
end
48+
49+
it 'returns abstract_ssm wrapped in a <p> tag' do
50+
expect(document.abstract_or_scope).to eq '<p>I will be wrapped</p>'
51+
end
52+
53+
context 'when abstract_ssm is not pressent' do
54+
let(:document) { SolrDocument.new(scopecontent_ssm: '<p>I am wrapped</p>') }
55+
56+
it 'returns scopecontent_ssm' do
57+
expect(document.abstract_or_scope).to eq '<p>I am wrapped</p>'
58+
end
59+
end
60+
end
61+
4462
describe 'digital objects' do
4563
let(:document) do
4664
SolrDocument.new(

0 commit comments

Comments
 (0)