Skip to content

Commit 744d5c6

Browse files
committed
Strip type attribute from HTML in elements formatted with EAD render. Fixes #1604
1 parent c87c153 commit 744d5c6

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/helpers/arclight/ead_format_helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def wrap_in_paragraph(value)
6565
end
6666

6767
def format_render_attributes(node) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
68+
node.remove_attribute('type')
69+
6870
case node.attr('render')
6971
when 'altrender'
7072
node.name = 'span'

spec/helpers/arclight/ead_format_helpers_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@
121121
content = helper.render_html_tags(value: ['The <emph render="underline">Mona Lisa</emph> hangs in the Louvre.'])
122122
expect(content).to eq 'The <span class="text-underline">Mona Lisa</span> hangs in the Louvre.'
123123
end
124+
125+
it 'strips out the xlink:type attribute' do
126+
content = helper.render_html_tags(value: ['He acted as photo editor for the student daily newspaper, <title
127+
xlink:type="simple" render="italic">The Chronicle</title>.'])
128+
expect(content).to eq_ignoring_whitespace \
129+
'He acted as photo editor for the student daily newspaper, <em>The Chronicle</em>.'
130+
end
124131
end
125132

126133
describe 'links' do

0 commit comments

Comments
 (0)