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
@@ -59,48 +59,49 | |||
|
59 | 59 | redirect_to :action => 'task', :id => params[:id] |
|
60 | 60 | else |
|
61 | 61 | redirect_to :action => 'test_request', :id => params[:id] |
|
62 | 62 | end |
|
63 | 63 | end |
|
64 | 64 | |
|
65 | 65 | def test_request |
|
66 | 66 | @test_request = TestRequest.find(params[:id]) |
|
67 | 67 | end |
|
68 | 68 | |
|
69 | 69 | def task |
|
70 | 70 | @task = Task.find(params[:id]) |
|
71 | 71 | end |
|
72 | 72 | |
|
73 | 73 | def submission |
|
74 | 74 | @submission = Submission.find(params[:id]) |
|
75 | 75 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
76 | 76 | lexer = case @submission.language.name |
|
77 | 77 | when "c" then Rouge::Lexers::C.new |
|
78 | 78 | when "cpp" then Rouge::Lexers::Cpp.new |
|
79 | 79 | when "pas" then Rouge::Lexers::Pas.new |
|
80 | 80 | when "ruby" then Rouge::Lexers::Ruby.new |
|
81 | 81 | when "python" then Rouge::Lexers::Python.new |
|
82 | 82 | when "java" then Rouge::Lexers::Java.new |
|
83 | + when "php" then Rouge::Lexers::PHP.new | |
|
83 | 84 | end |
|
84 | 85 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
85 | 86 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
86 | 87 | |
|
87 | 88 | end |
|
88 | 89 | |
|
89 | 90 | # various grader controls |
|
90 | 91 | |
|
91 | 92 | def stop |
|
92 | 93 | grader_proc = GraderProcess.find(params[:id]) |
|
93 | 94 | GraderScript.stop_grader(grader_proc.pid) |
|
94 | 95 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
95 | 96 | redirect_to :action => 'list' |
|
96 | 97 | end |
|
97 | 98 | |
|
98 | 99 | def stop_all |
|
99 | 100 | GraderScript.stop_graders(GraderProcess.find_running_graders + |
|
100 | 101 | GraderProcess.find_stalled_process) |
|
101 | 102 | flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' |
|
102 | 103 | redirect_to :action => 'list' |
|
103 | 104 | end |
|
104 | 105 | |
|
105 | 106 | def start_grading |
|
106 | 107 | GraderScript.start_grader('grading') |
You need to be logged in to leave comments.
Login now