Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'
KapilSachdev marked this conversation as resolved.
Show resolved Hide resolved
gem 'redcarpet'
gem 'yard'
6 changes: 2 additions & 4 deletions Gemfile.lock
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -73,9 +71,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)
KapilSachdev marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
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 @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
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 @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
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 @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
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 @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down