Module: LiquidFilter

Defined in:
lib/mayuki/liquid_filter.rb

Instance Method Summary collapse

Instance Method Details

#code(input) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mayuki/liquid_filter.rb', line 20

def code(input)
  system("pygmentize -f html -O linenos=1 "\
    "-o #{File.join($dir_o, input)}.html #{File.join($dir_i, input)}")
  text = IO.read(File.join($dir_o, "#{input}.html"))
  File.delete(File.join($dir_o, "#{input}.html"))
  
  "<blockquote>\n"\
  "<div class='pygments'>\n"\
  "#{text}"\
  "\n</div>"\
  "\n</blockquote>"
end

#source(input, lang) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mayuki/liquid_filter.rb', line 3

def source(input, lang)
  system("pygmentize -f html -l #{lang} -O linenos=1 "\
    "-o #{File.join($dir_o, input)}.html #{File.join($dir_i, input)}")
  text = IO.read(File.join($dir_o, "#{input}.html"))
  File.delete(File.join($dir_o, "#{input}.html"))
  
  "<blockquote>\n"\
  "<div class='pygments'>\n"\
  "#{text}"\
  "\n</div>"\
  "\n</blockquote>"
end

#src(input, lang) ⇒ Object



16
17
18
# File 'lib/mayuki/liquid_filter.rb', line 16

def src(input, lang)
  source(input, lang)
end