Skip to content

Conversation

@volpatorafael
Copy link

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 method style_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

'
`


theme = Rouge::Themes::Base16.mode(:light)
if (@themeName == "github")
theme = Rouge::Themes::Github.new()
Copy link
Collaborator

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.

return CGI.escapeHTML(file.last) unless file_lexer

theme = Rouge::Themes::Base16.mode(:light)
if (@themeName == "github")
Copy link
Collaborator

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.

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]
Copy link
Collaborator

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants