File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -40,20 +40,28 @@ def self.up
40
40
end
41
41
end
42
42
43
+ module GitWeb ::Helpers
44
+ def inline_data ( identifier )
45
+ section = "__#{ identifier . to_s . upcase } __"
46
+ @@inline_data ||= File . read ( __FILE__ ) . gsub ( /.*__END__/m , '' )
47
+ data = @@inline_data . match ( /(#{ section } .)(.*?)((__)|(\Z ))/m )
48
+ data ? data [ 2 ] : nil # return nil if no second found
49
+ end
50
+ end
51
+
43
52
module GitWeb ::Controllers
44
53
45
54
class Stylesheet < R '/css/highlight.css'
46
55
def get
47
56
@headers [ 'Content-Type' ] = 'text/css'
48
- ending = File . read ( __FILE__ ) . gsub ( /.*__END__/m , '' )
49
- ending . gsub ( /__JS__.*/m , '' )
57
+ inline_data ( :css )
50
58
end
51
59
end
52
60
53
61
class JsHighlight < R '/js/highlight.js'
54
62
def get
55
63
@headers [ 'Content-Type' ] = 'text/css'
56
- File . read ( __FILE__ ) . gsub ( /.*__JS__/m , '' )
64
+ inline_data ( :js )
57
65
end
58
66
end
59
67
@@ -419,6 +427,8 @@ def GitWeb.create
419
427
420
428
# everything below this line is the css and javascript for syntax-highlighting
421
429
__END__
430
+
431
+ __CSS__
422
432
pre.sh_sourceCode {
423
433
background-color: white;
424
434
color: black;
You can’t perform that action at this time.
0 commit comments