Description:
add lexer for php
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r451:46e3534d5d5d - - 1 file changed: 1 inserted, 0 deleted
@@ -71,24 +71,25 | |||||
|
71 | end |
|
71 | end |
|
72 |
|
72 | ||
|
73 | def submission |
|
73 | def submission |
|
74 | @submission = Submission.find(params[:id]) |
|
74 | @submission = Submission.find(params[:id]) |
|
75 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
75 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
76 | lexer = case @submission.language.name |
|
76 | lexer = case @submission.language.name |
|
77 | when "c" then Rouge::Lexers::C.new |
|
77 | when "c" then Rouge::Lexers::C.new |
|
78 | when "cpp" then Rouge::Lexers::Cpp.new |
|
78 | when "cpp" then Rouge::Lexers::Cpp.new |
|
79 | when "pas" then Rouge::Lexers::Pas.new |
|
79 | when "pas" then Rouge::Lexers::Pas.new |
|
80 | when "ruby" then Rouge::Lexers::Ruby.new |
|
80 | when "ruby" then Rouge::Lexers::Ruby.new |
|
81 | when "python" then Rouge::Lexers::Python.new |
|
81 | when "python" then Rouge::Lexers::Python.new |
|
82 | when "java" then Rouge::Lexers::Java.new |
|
82 | when "java" then Rouge::Lexers::Java.new |
|
|
83 | + when "php" then Rouge::Lexers::PHP.new | ||
|
83 | end |
|
84 | end |
|
84 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
85 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
85 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
86 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
86 |
|
87 | ||
|
87 | end |
|
88 | end |
|
88 |
|
89 | ||
|
89 | # various grader controls |
|
90 | # various grader controls |
|
90 |
|
91 | ||
|
91 | def stop |
|
92 | def stop |
|
92 | grader_proc = GraderProcess.find(params[:id]) |
|
93 | grader_proc = GraderProcess.find(params[:id]) |
|
93 | GraderScript.stop_grader(grader_proc.pid) |
|
94 | GraderScript.stop_grader(grader_proc.pid) |
|
94 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
95 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
You need to be logged in to leave comments.
Login now