Class: Pocketbook::BookRenderer::Chapter::Compiled

Inherits:
Struct
  • Object
show all
Defined in:
lib/pocketbook/book_renderer/chapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#htmlObject

Returns the value of attribute html

Returns:

  • (Object)

    the current value of html



9
10
11
# File 'lib/pocketbook/book_renderer/chapter.rb', line 9

def html
  @html
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



9
10
11
# File 'lib/pocketbook/book_renderer/chapter.rb', line 9

def id
  @id
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



9
10
11
# File 'lib/pocketbook/book_renderer/chapter.rb', line 9

def source
  @source
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



9
10
11
# File 'lib/pocketbook/book_renderer/chapter.rb', line 9

def title
  @title
end

#toc_headingsObject

Returns the value of attribute toc_headings

Returns:

  • (Object)

    the current value of toc_headings



9
10
11
# File 'lib/pocketbook/book_renderer/chapter.rb', line 9

def toc_headings
  @toc_headings
end

Instance Method Details

#article_html(escape_html:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/pocketbook/book_renderer/chapter.rb', line 10

def article_html(escape_html:)
  <<~HTML
    <article class="chapter" id="#{escape_html.call(id)}" data-source="#{escape_html.call(source)}" data-title="#{escape_html.call(title)}">
      <p class="running-chapter-title" aria-hidden="true">#{escape_html.call(title)}</p>
      #{html}
    </article>
  HTML
end