diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-04-30 01:02:35 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-04-30 01:02:35 -0600 |
| commit | 366d9dfd41f814478ebbdf613f7b3a8306888c51 (patch) | |
| tree | 5e7ef891cc68596d9be843a4e9eb9c3d2c832a23 /lib | |
| parent | bb47c333df0aaab6daefa1f4acd3ba3d2623c0c8 (diff) | |
make value arg on assign_caption requires (as is consistent with usage)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/asciidoctor/abstract_block.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/asciidoctor/abstract_block.rb b/lib/asciidoctor/abstract_block.rb index 7046e58b..740bc370 100644 --- a/lib/asciidoctor/abstract_block.rb +++ b/lib/asciidoctor/abstract_block.rb @@ -370,13 +370,13 @@ class AbstractBlock < AbstractNode # The parts of a complete caption are: <prefix> <number>. <title> # This partial caption represents the part the precedes the title. # - # value - The explicit String caption to assign to this block (default: nil). - # caption_context - The Symbol context to use when resolving caption-related attributes. - # If not provided, the name of the context for this block is used. + # value - The String caption to assign to this block or nil to use document attribute. + # caption_context - The Symbol context to use when resolving caption-related attributes. If not provided, the name of + # the context for this block is used. Only certain contexts allow the caption to be looked up. # (default: @context) # # Returns nothing. - def assign_caption value = nil, caption_context = @context + def assign_caption value, caption_context = @context unless @caption || !@title || (@caption = value || @document.attributes['caption']) if (attr_name = CAPTION_ATTR_NAMES[caption_context]) && (prefix = @document.attributes[attr_name]) @caption = %(#{prefix} #{@numeral = @document.increment_and_store_counter %(#{caption_context}-number), self}. ) |
