Class: Idml::Render::BookmarkResolver
- Inherits:
-
Object
- Object
- Idml::Render::BookmarkResolver
- Defined in:
- lib/idml/render/bookmark_resolver.rb
Overview
Resolves IDML bookmarks to (title, page_index) pairs ready for
PdfrbWriter#add_bookmark. Uses the document's designmap to
look up:
Bookmark#destination (Self) →
HyperlinkPageDestination#destination_page (Page Self) →
PDF page index (via spread iteration)
Bookmarks whose destination chain cannot be resolved are skipped silently.
Instance Method Summary collapse
-
#each ⇒ Object
Yields [title, page_index] pairs for each resolvable bookmark.
-
#initialize(package) ⇒ BookmarkResolver
constructor
A new instance of BookmarkResolver.
Constructor Details
#initialize(package) ⇒ BookmarkResolver
16 17 18 |
# File 'lib/idml/render/bookmark_resolver.rb', line 16 def initialize(package) @package = package end |
Instance Method Details
#each ⇒ Object
Yields [title, page_index] pairs for each resolvable bookmark.
21 22 23 24 25 26 27 28 |
# File 'lib/idml/render/bookmark_resolver.rb', line 21 def each return enum_for(:each) unless block_given? bookmarks.each do |bookmark| entry = resolve(bookmark) yield entry if entry end end |