# File lib/review/book/index.rb, line 186 def ImageIndex.item_type '(image|graph|imgtable)' end
# 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
# 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
# File lib/review/book/index.rb, line 205 def find_path(id) @image_finder.find_path(id) end