Class: Octopress::Printable::GistConverter

Inherits:
Converter
  • Object
show all
Defined in:
lib/octopress-printable/gist.rb

Instance Attribute Summary

Attributes inherited from Converter

#match

Instance Method Summary collapse

Methods inherited from Converter

#before_xelatex, #envs, get_includes, #initialize, #last_xelatex, #pandoc_args, timestamp

Constructor Details

This class inherits a constructor from Octopress::Printable::Converter

Instance Method Details

#convert(line) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/octopress-printable/gist.rb', line 7

def convert(line)
  str = line

  if /{%\s+gist\s+(?<gist_txt>.*?)\s+%}/ =~ str
    @match = true

    gist = GistCache.new(gist_txt)
    gist_file = gist.render()
    if gist_file == ""
      str = ""
    else
      lang = "text"
      if /\.py$/ =~ gist_file
        lang = 'Python'
      end
 
      str = "\\inputminted[mathescape, linenos, frame=lines, framesep=2mm]{#{lang}}{#{gist_file}}"
    end
  end

  str
end

#headerObject



30
31
32
33
# File 'lib/octopress-printable/gist.rb', line 30

def header
  lines = []
  lines << '\\usepackage{minted}'
end

#xelatex_args(step) ⇒ Object



35
36
37
38
# File 'lib/octopress-printable/gist.rb', line 35

def xelatex_args(step)
  args = []
  args << "-shell-escape"
end