class ReVIEW::Book::ImageIndex

Attributes

image_finder[R]

Public Class Methods

item_type() click to toggle source
# File ../../../../../lib/review/book/index.rb, line 186
def ImageIndex.item_type
  '(image|graph|imgtable)'
end
new(items, chapid, basedir, types, builder) click to toggle source
Calls superclass method ReVIEW::Book::Index.new
# File ../../../../../lib/review/book/index.rb, line 192
def initialize(items, chapid, basedir, types, builder)
  super items
  items.each do |i|
    i.index = self
  end
  @chapid = chapid
  @basedir = basedir
  @types = types

  @image_finder = ReVIEW::Book::ImageFinder.new(basedir, chapid,
                                                builder, types)
end
parse(src, *args) click to toggle source
# File ../../../../../lib/review/book/index.rb, line 146
def self.parse(src, *args)
  items = []
  seq = 1
  src.grep(%r<^//#{item_type()}>) do |line|
    # ex. ["//image", "id", "", "caption"]
    elements = line.split(/\[(.*?)\]/)
    if elements[1].present?
      items.push item_class().new(elements[1], seq, elements[3])
      seq += 1
      if elements[1] == ""
        warn "warning: no ID of #{item_type()} in #{line}"
      end
    end
  end
  new(items, *args)
end

Public Instance Methods

find_path(id) click to toggle source
# File ../../../../../lib/review/book/index.rb, line 205
def find_path(id)
  @image_finder.find_path(id)
end