Class: Nanoc::Filters::ColorizeSyntax::Colorizers::PygmentizeColorizer Private
- Inherits:
-
Abstract
- Object
- Abstract
- Nanoc::Filters::ColorizeSyntax::Colorizers::PygmentizeColorizer
- Defined in:
- lib/nanoc/filters/colorize_syntax/colorizers.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Methods inherited from Abstract
Instance Method Details
#process(code, language, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/nanoc/filters/colorize_syntax/colorizers.rb', line 59 def process(code, language, params = {}) check_availability('pygmentize', '-V') params[:encoding] ||= 'utf-8' params[:nowrap] ||= 'True' cmd = ['pygmentize', '-l', language, '-f', 'html'] cmd << '-O' << params.map { |k, v| "#{k}=#{v}" }.join(',') unless params.empty? TTY::Command.new(printer: :null).run(*cmd, input: code).out end |