Class: Jekyll::SectionComponent

Inherits:
ComponentBlock
  • Object
show all
Defined in:
lib/jekyll/jelly/components/blocks/section.rb

Constant Summary collapse

DEFAULT_TAG_PROPS =
[
  "id",
  "style",
]

Instance Method Summary collapse

Instance Method Details

#template(context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jekyll/jelly/components/blocks/section.rb', line 10

def template(context)
  class_name = @props["class"]
  container = @props["container"].nil? ? true : @props["container"]
  content = @props["content"]
  default_props = selector_props(DEFAULT_TAG_PROPS)

  if (container)
    content = %Q[
      <div class="o-container">
        #{content}
      </div>
    ]
  end

  render = %Q[
    <div class="o-section #{class_name}" #{default_props}>
      #{content}
    </div>
  ]
end