Class: NotionToHtml::Page
- Inherits:
-
Object
- Object
- NotionToHtml::Page
- Includes:
- Renderers
- Defined in:
- lib/notion_to_html/page.rb
Constant Summary
Constants included from Renderers
Renderers::DEFAULT_CSS_CLASSES
Instance Attribute Summary collapse
-
#blocks ⇒ Array<BaseBlock>
readonly
The blocks of the page, representing the content sections.
-
#metadata ⇒ BasePage
readonly
The metadata of the page, encapsulating details like title, description, and published date.
Instance Method Summary collapse
-
#formatted_blocks(options = {}) ⇒ Array<String>
Formats and renders the blocks of the page.
-
#initialize(base_page, base_blocks) ⇒ Page
constructor
Initializes a new Page object.
Methods included from Renderers
#annotation_to_css_class, #render_bulleted_list_item, #render_callout, #render_code, #render_date, #render_heading_1, #render_heading_2, #render_heading_3, #render_image, #render_numbered_list_item, #render_paragraph, #render_quote, #render_table_of_contents, #render_video, #text_renderer
Constructor Details
#initialize(base_page, base_blocks) ⇒ Page
Initializes a new Page object.
23 24 25 26 |
# File 'lib/notion_to_html/page.rb', line 23 def initialize(base_page, base_blocks) @metadata = base_page @blocks = base_blocks end |
Instance Attribute Details
#blocks ⇒ Array<BaseBlock> (readonly)
Returns The blocks of the page, representing the content sections.
13 14 15 |
# File 'lib/notion_to_html/page.rb', line 13 def blocks @blocks end |
#metadata ⇒ BasePage (readonly)
Returns The metadata of the page, encapsulating details like title, description, and published date.
11 12 13 |
# File 'lib/notion_to_html/page.rb', line 11 def @metadata end |
Instance Method Details
#formatted_blocks(options = {}) ⇒ Array<String>
Formats and renders the blocks of the page.
31 32 33 |
# File 'lib/notion_to_html/page.rb', line 31 def formatted_blocks( = {}) @blocks.map { |block| block.render() } end |