Skip to content

Commit

Permalink
enable Style/FormatStringToken rule and add exceptions [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Jun 7, 2021
1 parent 61effa1 commit 122f173
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ Style/ExponentialNotation:
Style/FormatString:
EnforcedStyle: sprintf
Style/FormatStringToken:
Enabled: false # NOTE annotated style needed to support theming language
Enabled: true
EnforcedStyle: unannotated
Style/GlobalStdStream:
Enabled: true
Style/GuardClause:
Expand Down
2 changes: 1 addition & 1 deletion lib/asciidoctor/pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ def draw_image_border top, w, h, alignment
def on_image_error _reason, node, target, opts
log :warn, opts[:message] if opts.key? :message
alt_text_vars = { alt: (node.attr 'alt'), target: target }
alt_text_template = @theme.image_alt_content || '%{link}[%{alt}]%{/link} | <em>%{target}</em>'
alt_text_template = @theme.image_alt_content || '%{link}[%{alt}]%{/link} | <em>%{target}</em>' # rubocop:disable Style/FormatStringToken
return if alt_text_template.empty?
if (link = node.attr 'link')
alt_text_vars[:link] = %(<a href="#{link}">)
Expand Down
2 changes: 1 addition & 1 deletion spec/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
end

it 'should be able to customize formatting of alt text using theme' do
pdf_theme = { image_alt_content: '%{alt} (%{target})' }
pdf_theme = { image_alt_content: '%{alt} (%{target})' } # rubocop:disable Style/FormatStringToken
(expect do
pdf = to_pdf 'image::no-such-image.png[Missing Image]', pdf_theme: pdf_theme, analyze: true
(expect pdf.lines).to eql ['Missing Image (no-such-image.png)']
Expand Down

0 comments on commit 122f173

Please sign in to comment.