Sha256: 2595495bbf44d8d9d75a66f67e0f0c49ae1755f60d85c25ec1b1c4618e194e85

Contents?: true

Size: 1.52 KB

Versions: 11

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module Asciidoctor
  module PDF
    module FormattedText
      module SourceWrap
        NoBreakSpace = ?\u00a0

        def wrap array
          initialize_wrap array
          stop = nil
          highlight_line = nil
          unconsumed = @arranger.unconsumed
          if (linenum_fragment = unconsumed[0] || {})[:linenum]
            linenum_spacer = { text: NoBreakSpace + (' ' * (linenum_fragment[:text].length - 1)) }
          end
          until stop
            if linenum_spacer && (first_fragment = unconsumed[0])
              if first_fragment[:linenum]
                highlight_line = (second_fragment = unconsumed[1]) && (second_fragment[:highlight]) ? second_fragment.dup : nil
              else
                first_fragment[:text] = first_fragment[:text].lstrip
                @arranger.unconsumed.unshift highlight_line if highlight_line
                @arranger.unconsumed.unshift linenum_spacer.dup
              end
            end
            @line_wrap.wrap_line document: @document, kerning: @kerning, width: available_width, arranger: @arranger, disable_wrap_by_char: @disable_wrap_by_char
            if enough_height_for_this_line?
              move_baseline_down
              print_line
            else
              stop = true
            end
            stop ||= @single_line || @arranger.finished?
          end
          @text = @printed_lines.join ?\n
          @everything_printed = @arranger.finished?
          @arranger.unconsumed
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.6.2 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.6.1 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.6.0 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.4 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.3 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.2 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.1 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.0 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.0.rc.3 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.0.rc.2 lib/asciidoctor/pdf/formatted_text/source_wrap.rb
asciidoctor-pdf-1.5.0.rc.1 lib/asciidoctor/pdf/formatted_text/source_wrap.rb