-
Notifications
You must be signed in to change notification settings - Fork 46
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
Receiving theme parameter to use the default or github #28
base: master
Are you sure you want to change the base?
Conversation
@@ -50,10 +50,16 @@ def syntax_highlight(file) | |||
file_lexer = Rouge::Lexer.find(file_type) | |||
return CGI.escapeHTML(file.last) unless file_lexer | |||
|
|||
theme = Rouge::Themes::Base16.mode(:light) | |||
if (@themeName == "github") | |||
theme = Rouge::Themes::Github.new() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/MethodCallWithoutArgsParentheses: Do not use parentheses for method calls with no arguments.
@@ -50,10 +50,16 @@ def syntax_highlight(file) | |||
file_lexer = Rouge::Lexer.find(file_type) | |||
return CGI.escapeHTML(file.last) unless file_lexer | |||
|
|||
theme = Rouge::Themes::Base16.mode(:light) | |||
if (@themeName == "github") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.
Style/ParenthesesAroundCondition: Don't use parentheses around the condition of an if.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -14,7 +14,7 @@ def initialize(params = {}) | |||
elsif !params.key?(:to) || params[:to].nil? | |||
raise ArgumentError.new 'where should I save the generated pdf file?' | |||
else | |||
@from, @to, @except = params[:from], params[:to], params[:except].to_s | |||
@from, @to, @except, @themeName = params[:from], params[:to], params[:except].to_s, params[:theme] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/ParallelAssignment: Do not use parallel assignment.
Naming/VariableName: Use snake_case for variable names.
Metrics/LineLength: Line is too long. [104/80]
Hello!
I facing some issues using the default Rouge theme, then I added a script param to switch to the Github theme (that works fine to me).
'/Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatters/html_inline.rb:15:in
safe_span': undefined methodstyle_for' for Rouge::Themes::Base16:Class (NoMethodError) Did you mean? style from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatters/html.rb:15:in
span'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatters/html_table.rb:30:in
block in stream' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/lexer.rb:315:in
block in lex'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:126:in
block in rule' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:305:in
instance_exec'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:305:in
block in step' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:287:in
each'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:287:in
step' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/regex_lexer.rb:268:in
stream_tokens'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/lexer.rb:307:in
lex' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatters/html_table.rb:27:in
each'from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatters/html_table.rb:27:in
stream' from /Users/rafael/.rvm/rubies/ruby-2.6.8/lib/ruby/gems/2.6.0/gems/rouge-2.0.7/lib/rouge/formatter.rb:37:in
format'from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:63:in
syntax_highlight' from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:40:in
block in pdf'from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:38:in
each' from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:38:in
pdf'from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:30:in
save' from /Users/rafael/Development/x4fare/code2pdf/lib/code2pdf/convert_to_pdf.rb:23:in
initialize'from /Users/rafael/Development/x4fare/code2pdf/bin/code2pdf:58:in
new' from /Users/rafael/Development/x4fare/code2pdf/bin/code2pdf:58:in
`