Module: Asciidoctor::PDF::FormattedText::InlineDestinationMarker

Defined in:
lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb

Class Method Summary collapse

Class Method Details

.render_behind(fragment) ⇒ Object

render_behind is called before the text is printed



8
9
10
11
12
13
14
15
16
17
# File 'lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb', line 8

def render_behind fragment
  return if (pdf = fragment.document).scratch?
  name = fragment.format_state[:name]
  pdf.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 true
end