Sha256: 7e226af379321417323f502dc47deab1c765179e727a960b075bccf86d1716ef

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

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.first, dest_rect.last)
        # prevent any text from being written
        fragment.conceal
      end
    end
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.alpha.14 lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb