fix(docs): Migrate to rouge [ci skip]

This commit is contained in:
Kapil Sachdev 2020-08-30 15:46:33 +05:30 committed by Elliot Winkler
parent 9733122ce3
commit 278a381ae8
13 changed files with 23 additions and 35 deletions

View File

@ -13,6 +13,6 @@ gem 'zeus', require: false
# YARD
gem 'fssm'
gem 'pygments.rb'
gem 'rouge'
gem 'redcarpet'
gem 'yard'

View File

@ -11,7 +11,6 @@ GEM
diff-lcs (1.3)
fssm (0.2.10)
method_source (1.0.0)
multi_json (1.14.1)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
@ -21,14 +20,13 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (2.2.2)
rainbow (3.0.0)
rake (13.0.1)
redcarpet (3.5.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -73,9 +71,9 @@ DEPENDENCIES
fssm
pry
pry-byebug
pygments.rb
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rubocop
rubocop-rails

View File

@ -1,20 +1,20 @@
YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')
require 'pygments.rb'
require 'rouge'
module YARD
module Templates
module Helpers
module HtmlSyntaxHighlightHelper
def html_syntax_highlight_ruby(source)
highlight_with_pygments(:ruby, source)
highlight(:ruby, source)
end
private
def highlight_with_pygments(language, source)
html = Pygments.highlight(source, lexer: language.to_s)
html.sub(%r{\A<div class="highlight">\s*<pre>}, '').sub(%r{</pre>\s*</div>\Z}, '')
def highlight(language, source)
lexer = Rouge::Lexers.const_get(language.capitalize)
Rouge::Formatters::HTML.new.format(lexer.new.lex(source))
end
end
end

View File

@ -13,7 +13,7 @@ gem "rubocop-rails", require: false
gem "warnings_logger"
gem "zeus", require: false
gem "fssm"
gem "pygments.rb"
gem "rouge"
gem "redcarpet"
gem "yard"
gem "spring"

View File

@ -83,7 +83,6 @@ GEM
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
multi_json (1.14.1)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
parallel (1.19.2)
@ -98,8 +97,6 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (1.6.13)
rack-test (0.6.3)
rack (>= 1.0)
@ -138,6 +135,7 @@ GEM
redcarpet (3.5.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -233,10 +231,10 @@ DEPENDENCIES
protected_attributes (~> 1.0.6)
pry
pry-byebug
pygments.rb
rails (= 4.2.11.1)
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rspec-rails (~> 3.9)
rubocop

View File

@ -13,7 +13,7 @@ gem "rubocop-rails", require: false
gem "warnings_logger"
gem "zeus", require: false
gem "fssm"
gem "pygments.rb"
gem "rouge"
gem "redcarpet"
gem "yard"
gem "spring"

View File

@ -76,7 +76,6 @@ GEM
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
multi_json (1.14.1)
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
@ -91,8 +90,6 @@ GEM
byebug (~> 11.0)
pry (~> 0.13.0)
puma (3.12.2)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (2.2.2)
rack-test (0.6.3)
rack (>= 1.0)
@ -131,6 +128,7 @@ GEM
redcarpet (3.5.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -225,11 +223,11 @@ DEPENDENCIES
pry
pry-byebug
puma (~> 3.0)
pygments.rb
rails (= 5.0.7.2)
rails-controller-testing (>= 1.0.1)
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rspec-rails (~> 3.9)
rubocop

View File

@ -13,7 +13,7 @@ gem "rubocop-rails", require: false
gem "warnings_logger"
gem "zeus", require: false
gem "fssm"
gem "pygments.rb"
gem "rouge"
gem "redcarpet"
gem "yard"
gem "spring"

View File

@ -83,7 +83,6 @@ GEM
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
multi_json (1.14.1)
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
@ -99,8 +98,6 @@ GEM
pry (~> 0.13.0)
public_suffix (4.0.1)
puma (3.12.2)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (2.2.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
@ -139,6 +136,7 @@ GEM
redcarpet (3.5.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -240,11 +238,11 @@ DEPENDENCIES
pry
pry-byebug
puma (~> 3.7)
pygments.rb
rails (= 5.1.7)
rails-controller-testing (>= 1.0.1)
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rspec-rails (~> 3.9)
rubocop

View File

@ -13,7 +13,7 @@ gem "rubocop-rails", require: false
gem "warnings_logger"
gem "zeus", require: false
gem "fssm"
gem "pygments.rb"
gem "rouge"
gem "redcarpet"
gem "yard"
gem "spring"

View File

@ -99,7 +99,6 @@ GEM
mini_portile2 (2.4.0)
minitest (5.13.0)
msgpack (1.3.1)
multi_json (1.14.1)
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
@ -115,8 +114,6 @@ GEM
pry (~> 0.13.0)
public_suffix (4.0.1)
puma (3.12.2)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (2.2.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
@ -156,6 +153,7 @@ GEM
redcarpet (3.5.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -259,11 +257,11 @@ DEPENDENCIES
pry
pry-byebug
puma (~> 3.11)
pygments.rb
rails (= 5.2.4.1)
rails-controller-testing (>= 1.0.1)
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rspec-rails (~> 3.9)
rubocop

View File

@ -13,7 +13,7 @@ gem "rubocop-rails", require: false
gem "warnings_logger"
gem "zeus", require: false
gem "fssm"
gem "pygments.rb"
gem "rouge"
gem "redcarpet"
gem "yard"
gem "spring"

View File

@ -107,7 +107,6 @@ GEM
mini_portile2 (2.4.0)
minitest (5.13.0)
msgpack (1.3.1)
multi_json (1.14.1)
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
@ -124,8 +123,6 @@ GEM
public_suffix (4.0.1)
puma (4.3.1)
nio4r (~> 2.0)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (2.2.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
@ -167,6 +164,7 @@ GEM
redcarpet (3.5.0)
regexp_parser (1.6.0)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
@ -273,11 +271,11 @@ DEPENDENCIES
pry
pry-byebug
puma (~> 4.1)
pygments.rb
rails (= 6.0.2.1)
rails-controller-testing (>= 1.0.1)
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rspec-rails (~> 3.9)
rubocop