Skip to content

Commit

Permalink
fix(docs): Migrate to rouge [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
KapilSachdev committed Aug 30, 2020
1 parent 09bbc40 commit d17b876
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -13,6 +13,6 @@ gem 'zeus', require: false

# YARD
gem 'fssm'
gem 'pygments.rb'
gem 'rouge'
gem 'redcarpet'
gem 'yard'
6 changes: 2 additions & 4 deletions Gemfile.lock
Expand Up @@ -12,7 +12,6 @@ GEM
fssm (0.2.10)
jaro_winkler (1.5.4)
method_source (1.0.0)
multi_json (1.14.1)
parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
Expand All @@ -22,12 +21,11 @@ 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)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -68,9 +66,9 @@ DEPENDENCIES
fssm
pry
pry-byebug
pygments.rb
rake (= 13.0.1)
redcarpet
rouge
rspec (~> 3.9)
rubocop
rubocop-rails
Expand Down
10 changes: 5 additions & 5 deletions doc_config/yard/setup.rb
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_4_2.gemfile
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions gemfiles/rails_4_2.gemfile.lock
Expand Up @@ -84,7 +84,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.1)
Expand All @@ -99,8 +98,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)
Expand Down Expand Up @@ -137,6 +134,7 @@ GEM
ffi (~> 1.0)
rdoc (4.3.0)
redcarpet (3.5.0)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -228,10 +226,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
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_5_0.gemfile
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions gemfiles/rails_5_0.gemfile.lock
Expand Up @@ -77,7 +77,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)
Expand All @@ -92,8 +91,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)
Expand Down Expand Up @@ -130,6 +127,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.0)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -220,11 +218,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
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_5_1.gemfile
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions gemfiles/rails_5_1.gemfile.lock
Expand Up @@ -84,7 +84,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)
Expand All @@ -100,8 +99,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)
Expand Down Expand Up @@ -138,6 +135,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.0)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -235,11 +233,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
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_5_2.gemfile
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions gemfiles/rails_5_2.gemfile.lock
Expand Up @@ -100,7 +100,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)
Expand All @@ -116,8 +115,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)
Expand Down Expand Up @@ -155,6 +152,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.0)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -254,11 +252,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
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_6_0.gemfile
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions gemfiles/rails_6_0.gemfile.lock
Expand Up @@ -108,7 +108,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)
Expand All @@ -125,8 +124,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)
Expand Down Expand Up @@ -167,6 +164,7 @@ GEM
ffi (~> 1.0)
redcarpet (3.5.0)
regexp_parser (1.6.0)
rouge (3.22.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -270,11 +268,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
Expand Down

0 comments on commit d17b876

Please sign in to comment.