Module: Bindery::ContentMethods

Included in:
BookBuilder, Division
Defined in:
lib/bindery/content_methods.rb

Instance Method Summary collapse

Instance Method Details

#appendix(title, filename, options = {}, &block) ⇒ Object



31
32
33
# File 'lib/bindery/content_methods.rb', line 31

def appendix(title, filename, options={}, &block)
  div('appendix', title, filename, options, &block)
end

#chapter(title, filename, options = {}, &block) ⇒ Object



19
20
21
# File 'lib/bindery/content_methods.rb', line 19

def chapter(title, filename, options={}, &block)
  div('chapter', title, filename, options, &block)
end

#div(div_type, title, filename, options = {}) {|div| ... } ⇒ Object

Add a division to the book.

The following options are supported:

:body_only

the file contains only the body of the XHTML document, and Bindery should wrap it to create a valid document. Defaults to true.

Yields:

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
# File 'lib/bindery/content_methods.rb', line 10

def div(div_type, title, filename, options={})
  options = {:body_only => true}.merge(options)
  raise ArgumentError, "title not specified" if title.nil?
  raise ArgumentError, "file not specified" if filename.nil?
  div = Division.new(div_type, title, filename, options)
  divisions << div
  yield div if block_given?
end

#part(title, filename, options = {}, &block) ⇒ Object



27
28
29
# File 'lib/bindery/content_methods.rb', line 27

def part(title, filename, options={}, &block)
  div('part', title, filename, options, &block)
end

#section(title, filename, options = {}, &block) ⇒ Object



23
24
25
# File 'lib/bindery/content_methods.rb', line 23

def section(title, filename, options={}, &block)
  div('section', title, filename, options, &block)
end