Module: Rubyoshka::HTML

Included in:
HTMLRenderer
Defined in:
lib/rubyoshka/html.rb

Overview

Markup extensions

Constant Summary collapse

S_HTML5_DOCTYPE =
'<!DOCTYPE html>'

Instance Method Summary collapse

Instance Method Details

#html5(&block) ⇒ void

This method returns an undefined value.

Emits an HTML5 doctype tag and an html tag with the given block

Parameters:

  • block (Proc)

    nested HTML block



22
23
24
25
# File 'lib/rubyoshka/html.rb', line 22

def html5(&block)
  @buffer << S_HTML5_DOCTYPE
  self.html(&block)
end


27
28
29
30
31
32
33
34
35
36
# File 'lib/rubyoshka/html.rb', line 27

def link_stylesheet(href, custom_attributes = nil)
  attributes = {
    rel: 'stylesheet',
    href: href
  }
  if custom_attributes
    attributes = custom_attributes.merge(attributes)
  end
  link(**attributes)
end

#p(text = nil, **props, &block) ⇒ void

This method returns an undefined value.

Emits the p tag (overrides Object#p)

Parameters:

  • text (String) (defaults to: nil)

    text content of tag

  • props (Hash)

    tag attributes



13
14
15
# File 'lib/rubyoshka/html.rb', line 13

def p(text = nil, **props, &block)
  method_missing(:p, text, **props, &block)
end