Sha256: e94d5eea09820f243ac1f42903db4868514bef9fcece8b9cce78737fb46dee12
Contents?: true
Size: 675 Bytes
Versions: 4
Compression:
Stored size: 675 Bytes
Contents
class TP::Slide::Code < TP::Slide def render centered_header + "\n\n" + highlighted_code end def height code.lines.count + 2 end def width lines.collect { |line| line.rstrip.length }.max end def code content.lines.to_a.reject { |line| line.start_with? "```" }.join end def highlighted_code CodeRay.encode(code, language, :terminal) end def raw_language match = lines[2].match(/^\`{3}(\w+)/) match[1] if match end def language case raw_language when nil then "text" when "clj" then "clojure" when "objc" then "cpp" when "rb" then "ruby" else raw_language end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tp-0.5.1 | lib/tp/slide/code.rb |
tp-0.5.0 | lib/tp/slide/code.rb |
tp-0.4.1 | lib/tp/slide/code.rb |
tp-0.4.0 | lib/tp/slide/code.rb |