Added missing Ace sandbox in Ace::PygmentsFilter.
This commit is contained in:
parent
9f128f8fed
commit
e3941ba8e5
1 changed files with 12 additions and 10 deletions
|
@ -4,16 +4,18 @@ require "ace/filters"
|
|||
require "nokogiri"
|
||||
require "albino"
|
||||
|
||||
class PygmentsFilter < Filter
|
||||
def call(item, content)
|
||||
puts 'PygmentsFilter ************************'
|
||||
doc = Nokogiri::HTML(content)
|
||||
doc.css('pre').each do |pre|
|
||||
puts "\nWARNING: '#{item.original_path}' - element <pre> not contains attribute 'lang'\n" if pre['lang'].nil?
|
||||
puts "\nWARNING: '#{item.original_path}' - attribute 'lang' not contains any value\n" if !pre['lang'].nil? && pre['lang'].empty?
|
||||
puts "*** Syntax highlight using '#{pre['lang']}' lexer" unless pre['lang'].nil? || pre['lang'].empty?
|
||||
pre.replace Albino.colorize(pre.content, pre['lang']) unless pre['lang'].nil? || pre['lang'].empty?
|
||||
module Ace
|
||||
class PygmentsFilter < Filter
|
||||
def call(item, content)
|
||||
puts 'PygmentsFilter ************************'
|
||||
doc = Nokogiri::HTML(content)
|
||||
doc.css('pre').each do |pre|
|
||||
puts "\nWARNING: '#{item.original_path}' - element <pre> not contains attribute 'lang'\n" if pre['lang'].nil?
|
||||
puts "\nWARNING: '#{item.original_path}' - attribute 'lang' not contains any value\n" if !pre['lang'].nil? && pre['lang'].empty?
|
||||
puts "*** Syntax highlight using '#{pre['lang']}' lexer" unless pre['lang'].nil? || pre['lang'].empty?
|
||||
pre.replace Albino.colorize(pre.content, pre['lang']) unless pre['lang'].nil? || pre['lang'].empty?
|
||||
end
|
||||
doc
|
||||
end
|
||||
doc
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue