Module: Asbru::Cml

Defined in:
lib/asbru/cml.rb

Overview

This module defines a bunch of methods that make component based pages appear more similar to HTML. The limitation is that nested components won’t work.

Constant Summary collapse

C =
Asbru::Config.component_mode.tap(&:setup)

Class Method Summary collapse

Class Method Details

.h1(text, **opts) ⇒ Object



17
18
19
20
21
# File 'lib/asbru/cml.rb', line 17

def h1 text, **opts
  C.send "#{prefix(opts)}_title",
      size: 'h1',
      text: text
end

.h2(text, **opts) ⇒ Object



23
24
25
26
27
# File 'lib/asbru/cml.rb', line 23

def h2 text, **opts
  C.send "#{prefix(opts)}_title",
      size: 'h2',
      text: text
end

.h3(text, **opts) ⇒ Object



29
30
31
32
33
# File 'lib/asbru/cml.rb', line 29

def h3 text, **opts
  C.send "#{prefix(opts)}_title",
      size: 'h3',
      text: text
end

.h4(text, **opts) ⇒ Object



35
36
37
38
39
# File 'lib/asbru/cml.rb', line 35

def h4 text, **opts
  C.send "#{prefix(opts)}_title",
      size: 'h4',
      text: text
end

.h5(text, **opts) ⇒ Object



41
42
43
44
45
# File 'lib/asbru/cml.rb', line 41

def h5 text, **opts
  C.send "#{prefix(opts)}_title",
      size: 'h5',
      text: text
end

.hr(color: 'stable-500', **opts) ⇒ Object



47
48
49
50
51
# File 'lib/asbru/cml.rb', line 47

def hr color: 'stable-500', **opts
  C.send "#{prefix}_divider",
      color: color,
      height: 1
end

.p(text, **opts) ⇒ Object



11
12
13
14
15
# File 'lib/asbru/cml.rb', line 11

def p text, **opts
  C.send "#{prefix(opts)}_content",
      text: text,
      **opts
end

.vertical_spacer(height, **opts) ⇒ Object



53
54
55
56
57
# File 'lib/asbru/cml.rb', line 53

def vertical_spacer height, **opts
  C.send "#{prefix(opts)}_divider",
      color: :transparent,
      height: height
end