Sha256: 9b972760c583b61b8631d0cfde724c694a37725887aa3a2a6be82a83fa98dd35

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module Rpub
  class Epub
    class HtmlToc < XmlFile
      attr_reader :book

      def initialize(book)
        @book = book
        super()
      end

      def render
        xml.div :id => 'toc' do
          xml.h1 'Table of Contents'
          xml.div :class => 'toc' do
            book.outline.each do |(filename, heading)|
              xml.div :class => "level-#{heading.level}" do
                xml.a heading.text, :href => [filename, heading.html_id].join('#')
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rpub-0.2.0 lib/rpub/epub/html_toc.rb