diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-01-27 17:52:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-27 17:52:47 -0700 |
| commit | 6f144c91f00a8f2974db18d8936b009d1068fcd1 (patch) | |
| tree | c443388b248b4ae95b3aa766bb5b8517519295c9 | |
| parent | 83ee9894d0e7b2d00c778e1375d96e9283534c02 (diff) | |
resolves #3032 alias sprintf to sub_placeholder (PR #3034)
| -rw-r--r-- | lib/asciidoctor/abstract_block.rb | 2 | ||||
| -rw-r--r-- | lib/asciidoctor/section.rb | 8 | ||||
| -rw-r--r-- | lib/asciidoctor/substitutors.rb | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/asciidoctor/abstract_block.rb b/lib/asciidoctor/abstract_block.rb index 8bebbe04..18d06274 100644 --- a/lib/asciidoctor/abstract_block.rb +++ b/lib/asciidoctor/abstract_block.rb @@ -328,7 +328,7 @@ class AbstractBlock < AbstractNode elsif xrefstyle && @title && @caption case xrefstyle when 'full' - quoted_title = sprintf sub_quotes(@document.compat_mode ? %q(``%s'') : '"`%s`"'), title + quoted_title = sub_placeholder (sub_quotes @document.compat_mode ? %q(``%s'') : '"`%s`"'), title if @numeral && (prefix = @document.attributes[@context == :image ? 'figure-caption' : %(#{@context}-caption)]) %(#{prefix} #{@numeral}, #{quoted_title}) else diff --git a/lib/asciidoctor/section.rb b/lib/asciidoctor/section.rb index ebf2d752..f116fead 100644 --- a/lib/asciidoctor/section.rb +++ b/lib/asciidoctor/section.rb @@ -129,9 +129,9 @@ class Section < AbstractBlock case xrefstyle when 'full' if (type = @sectname) == 'chapter' || type == 'appendix' - quoted_title = sprintf sub_quotes('_%s_'), title + quoted_title = sub_placeholder (sub_quotes '_%s_'), title else - quoted_title = sprintf sub_quotes(@document.compat_mode ? %q(``%s'') : '"`%s`"'), title + quoted_title = sub_placeholder (sub_quotes @document.compat_mode ? %q(``%s'') : '"`%s`"'), title end if (signifier = @document.attributes[%(#{type}-refsig)]) %(#{signifier} #{sectnum '.', ','} #{quoted_title}) @@ -145,10 +145,10 @@ class Section < AbstractBlock sectnum '.', '' end else # 'basic' - (type = @sectname) == 'chapter' || type == 'appendix' ? (sprintf sub_quotes('_%s_'), title) : title + (type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title end else # apply basic styling - (type = @sectname) == 'chapter' || type == 'appendix' ? (sprintf sub_quotes('_%s_'), title) : title + (type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title end else title diff --git a/lib/asciidoctor/substitutors.rb b/lib/asciidoctor/substitutors.rb index 25ed8337..40f0bcfc 100644 --- a/lib/asciidoctor/substitutors.rb +++ b/lib/asciidoctor/substitutors.rb @@ -1467,6 +1467,8 @@ module Substitutors process_callouts ? sub_callouts(sub_specialchars source) : (sub_specialchars source) end + alias :sub_placeholder :sprintf + # Internal: Lock-in the substitutions for this block # # Looks for an attribute named "subs". If present, resolves substitutions |
