class Hylite::Pygments
Public Class Methods
available?()
click to toggle source
# File lib/hylite/hyliters.rb, line 49 def self.available? ENV['PATH'].split(File::PATH_SEPARATOR).any? do |dir| File.exist? File.join(dir, 'pygmentize') end end
Public Instance Methods
call()
click to toggle source
# File lib/hylite/hyliters.rb, line 59 def call # From Fish, you can see all styles with: # for style in (pygmentize -L styles | sed -n '/\*/s/[*: ]//gp'); echo \n===== $style =====; pygmentize -f terminal256 -O style=$style -l ruby < lib/hylite.rb ; end out, err, status = Open3.capture3( 'pygmentize', '-f', 'terminal256', '-O', 'style=monokai', '-l', lang, stdin_data: code ) return out if status.success? && err.empty? raise "Uhhh, what led to this, I want to test it but don't know what can cause it / how to mimic it (and therefore what it should do)" end
type()
click to toggle source
# File lib/hylite/hyliters.rb, line 55 def type :pygments end