Sha256: ef2e913b7e517733724decf0e973415ec11a6d0469e44ac85896328eb028979a

Contents?: true

Size: 738 Bytes

Versions: 11

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

module Asciidoctor::PDF::FormattedText
  module InlineDestinationMarker
    module_function

    # render_behind is called before the text is printed
    def render_behind fragment
      unless (pdf = fragment.document).scratch?
        if (name = fragment.format_state[:name])
          (pdf.instance_variable_get :@index).link_dest_to_page name, pdf.page_number if fragment.format_state[:type] == :indexterm
          # get precise position of the reference (x, y)
          dest_rect = fragment.absolute_bounding_box
          pdf.add_dest name, (pdf.dest_xyz dest_rect[0], dest_rect[-1])
          # prevent any text from being written
          fragment.conceal
        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/inline_destination_marker.rb
asciidoctor-pdf-1.6.1 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.6.0 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.4 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.3 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.2 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.1 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.rc.3 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.rc.2 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.rc.1 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb