Class: Idml::Render::StoryThreader

Inherits:
Object
  • Object
show all
Defined in:
lib/idml/render/story_threader.rb

Overview

Builds text frame chains from PreviousTextFrame/NextTextFrame links. A story flows across linked frames: the first frame gets lines that fit, overflow goes to the next frame, and so on.

Defined Under Namespace

Classes: Thread

Class Method Summary collapse

Class Method Details

.build_chains(spread) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/idml/render/story_threader.rb', line 11

def self.build_chains(spread)
  chains = []
  return chains unless spread

  frames_by_id = collect_text_frames(spread)
  frames_by_id.each_value do |frame|
    next unless chain_head?(frame)

    chains << build_chain(frame, frames_by_id)
  end
  chains
end