Class: EBPS::Conversion::Oebps::IndexFactory

Inherits:
Factory
  • Object
show all
Defined in:
lib/ebps/conversion/oebps.rb

Instance Attribute Summary

Attributes inherited from Factory

#uid

Instance Method Summary collapse

Constructor Details

#initialize(uid, subject, ids, tmpdir) ⇒ IndexFactory

Returns a new instance of IndexFactory.



220
221
222
223
224
225
226
# File 'lib/ebps/conversion/oebps.rb', line 220

def initialize uid, subject, ids, tmpdir
  super subject, ids, tmpdir
  @builder.declare! :DOCTYPE, :html, :PUBLIC,
                    "-//W3C//DTD XHTML 1.0 Strict//EN",
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  @uid = uid
end

Instance Method Details

#to_htmlObject



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/ebps/conversion/oebps.rb', line 227

def to_html
  @builder.html "xmlns" => "http://www.w3.org/1999/xhtml" do |xml|
    xml.head do
      xml.meta 'http-equiv' => 'Content-Type',
               'content' => 'text/html;charset=utf-8'
      xml.title @uid
      xml.link 'type' => 'text/css', 'rel' => 'stylesheet',
               'href' => File.basename(EBPS.config.stylesheet)
    end
    xml.body 'id' => @uid do
      xml.p 'class' => 'ebps' do |xml|
        @subject.each do |name, id, content, _|
          if id
            xml.a content, 'href' => name
            xml.br
          else
            xml.a 'id' => name, 'name' => name
          end
        end
      end
      if EBPS.config.kindle_quirks
        xml.mbp :pagebreak
      end
    end
  end
end