Sha256: a7328b2e2bdbabfaac1caac2f43a5e8bca08fc13b7f5b461ef9287fdcf911551

Contents?: true

Size: 727 Bytes

Versions: 7

Compression:

Stored size: 727 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])
        if fragment.format_state[:type] == :indexterm
          (pdf.instance_variable_get :@index).link_dest_to_page name, pdf.page_number
        end
        # 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

7 entries across 7 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.beta.8 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.7 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.6 lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.5 lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.4 lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.3 lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb
asciidoctor-pdf-1.5.0.beta.2 lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb