# File lib/review/epubmaker.rb, line 493 def initialize(headlines) @level = nil @content = "" @headlines = headlines end
# File lib/review/epubmaker.rb, line 516 def tag_end(name) if name =~ /\Ah\d+/ @headlines.push({"level" => @level, "id" => @id, "title" => @content, "notoc" => @notoc}) if @id.present? @content = "" @level = nil @id = nil @notoc = nil end end
# File lib/review/epubmaker.rb, line 499 def tag_start(name, attrs) if name =~ /\Ah(\d+)/ if @level.present? raise "#{name}, #{attrs}" end @level = $1.to_i @id = attrs["id"] if attrs["id"].present? @notoc = attrs["notoc"] if attrs["notoc"].present? elsif !@level.nil? if name == "img" && attrs["alt"].present? @content << attrs["alt"] elsif name == "a" && attrs["id"].present? @id = attrs["id"] end end end
# File lib/review/epubmaker.rb, line 526 def text(text) if @level.present? @content << text.gsub("\t", " ") # FIXME:区切り文字 end end