# File ../../../../../lib/review/book/chapter.rb, line 23 def initialize(book, number, name, path, io = nil) @book = book @number = number @name = name @path = path @io = io @title = nil @content = nil @list_index = nil @table_index = nil @footnote_index = nil @image_index = nil @icon_index = nil @numberless_image_index = nil @indepimage_index = nil @headline_index = nil @column_index = nil end
# File ../../../../../lib/review/book/chapter.rb, line 46 def format_number(heading = true) if on_PREDEF? return "#{@number}" end if on_APPENDIX? return "#{@number}" if @number < 1 || @number > 27 type = @book.config["appendix_format"].blank? ? "arabic" : @book.config["appendix_format"].downcase.strip appendix = case type when "roman" ROMAN[@number] when "alphabet", "alpha" ALPHA[@number] else # nil, "arabic", etc... "#{@number}" end if heading return "#{I18n.t("appendix", appendix)}" else return "#{appendix}" end end if heading "#{I18n.t("chapter", @number)}" else "#{@number}" end end
# File ../../../../../lib/review/book/chapter.rb, line 42 def inspect "\#<#{self.class} #{@number} #{@path}>" end
# File ../../../../../lib/review/book/chapter.rb, line 86 def on_APPENDIX? on_FILE?(@book.read_APPENDIX) end
# File ../../../../../lib/review/book/chapter.rb, line 78 def on_CHAPS? on_FILE?(@book.read_CHAPS) end
# File ../../../../../lib/review/book/chapter.rb, line 90 def on_POSTDEF? on_FILE?(@book.read_POSTDEF) end
# File ../../../../../lib/review/book/chapter.rb, line 82 def on_PREDEF? on_FILE?(@book.read_PREDEF) end
# File ../../../../../lib/review/tocparser.rb, line 339 def toc @toc ||= TOCParser.parse(self) unless @toc.size == 1 $stderr.puts "warning: chapter #{@toc.join} contains more than 1 chapter" end @toc.first end