Class: Jekyll::Pseudo::HtmlBrush

Inherits:
Brush
  • Object
show all
Defined in:
lib/jekyll-pseudo/html_brush.rb

Instance Method Summary collapse

Instance Method Details

#comment(txt) ⇒ Object



18
19
20
# File 'lib/jekyll-pseudo/html_brush.rb', line 18

def comment(txt)
  "<span class='comment'>/* #{txt.strip} */</span>"
end

#fn(txt) ⇒ Object



10
11
12
# File 'lib/jekyll-pseudo/html_brush.rb', line 10

def fn(txt)
  "<span class='function'>#{txt}</span>"
end

#indent(txt) ⇒ Object



26
27
28
# File 'lib/jekyll-pseudo/html_brush.rb', line 26

def indent(txt)
  "<span class='indent'>#{txt}</span>"
end

#op(txt) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jekyll-pseudo/html_brush.rb', line 30

def op(txt)
  symbol = case txt
  when '<' then '&lt;'
  when '>' then '&gt;'
  when '<=' then '&le;'
  when '>=' then '&ge;'
  when '<-' then '&larr;'
  when '->' then '&rarr;'
  else txt
  end
  # FIXME: html conversion for some operators
  "<span class='op'>#{symbol}</span>"
end

#plain(txt) ⇒ Object



44
45
46
# File 'lib/jekyll-pseudo/html_brush.rb', line 44

def plain(txt)
  txt
end

#string(txt) ⇒ Object



22
23
24
# File 'lib/jekyll-pseudo/html_brush.rb', line 22

def string(txt)
  "<span class='string'>#{txt}</span>"
end

#sym(txt) ⇒ Object



6
7
8
# File 'lib/jekyll-pseudo/html_brush.rb', line 6

def sym(txt)
  "<span class='symbol'>#{txt}</span>"
end

#var(txt) ⇒ Object



14
15
16
# File 'lib/jekyll-pseudo/html_brush.rb', line 14

def var(txt)
  "<span class='variable'>#{var}</span>"
end