diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-08-29 02:45:10 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-08-29 02:45:10 -0600 |
| commit | 0a52ba55e8d8ba62cbf13d963ce4a0084f9b85ce (patch) | |
| tree | ddf80f95c8c05d0164b1a51bbca42515ed1ecc3c | |
| parent | cbebc9fa357b610a14d0c25d3f79753f616b936e (diff) | |
fix shadowing of guard_indentation method; remove unused argument
| -rw-r--r-- | lib/asciidoctor-pdf/converter.rb | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/asciidoctor-pdf/converter.rb b/lib/asciidoctor-pdf/converter.rb index 4aca8ffa..fc54102d 100644 --- a/lib/asciidoctor-pdf/converter.rb +++ b/lib/asciidoctor-pdf/converter.rb @@ -1663,7 +1663,7 @@ class Converter < ::Prawn::Document end fragments = text_formatter.format result fragments = restore_conums fragments, conum_mapping, num_trailing_spaces, linenums if conum_mapping - fragments = guard_indentation fragments + fragments = guard_indentation_in_fragments fragments when 'rouge' if (srclang = node.attr 'language', nil, false) if srclang.include? '?' @@ -1822,18 +1822,6 @@ class Converter < ::Prawn::Document @conum_glyphs[number - 1] end - # Adds guards to preserve indentation - def guard_indentation fragments - start_of_line = true - fragments.each do |fragment| - next if (text = fragment[:text]).empty? - text[0] = GuardedIndent if start_of_line && (text.start_with? ' ') - text.gsub! InnerIndent, GuardedInnerIndent if text.include? InnerIndent - start_of_line = text.end_with? LF - end - fragments - end - def convert_table node add_dest_for_block node if node.id # TODO we could skip a lot of the logic below when num_rows == 0 @@ -3570,7 +3558,7 @@ class Converter < ::Prawn::Document (height_of string, leading: line_metrics.leading, final_gap: line_metrics.final_gap) + line_metrics.padding_top + line_metrics.padding_bottom end - def guard_indentation string, guard_indent = true + def guard_indentation string if string string[0] = GuardedIndent if string.start_with? ' ' string.gsub! InnerIndent, GuardedInnerIndent if string.include? InnerIndent @@ -3580,6 +3568,17 @@ class Converter < ::Prawn::Document end end + def guard_indentation_in_fragments fragments + start_of_line = true + fragments.each do |fragment| + next if (text = fragment[:text]).empty? + text[0] = GuardedIndent if start_of_line && (text.start_with? ' ') + text.gsub! InnerIndent, GuardedInnerIndent if text.include? InnerIndent + start_of_line = text.end_with? LF + end + fragments + end + # Derive a PDF-safe, ASCII-only anchor name from the given value. # Encodes value into hex if it contains characters outside the ASCII range. # If value is nil, derive an anchor name from the default_value, if given. |
