@@ -1,56 +1,56 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module Redmine |
|
19 | 19 | module SyntaxHighlighting |
|
20 | 20 | |
|
21 | 21 | class << self |
|
22 | 22 | attr_reader :highlighter |
|
23 | 23 | delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter |
|
24 | 24 | |
|
25 | 25 | def highlighter=(name) |
|
26 | 26 | if name.is_a?(Module) |
|
27 | 27 | @highlighter = name |
|
28 | 28 | else |
|
29 | 29 | @highlighter = const_get(name) |
|
30 | 30 | end |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | module CodeRay |
|
35 | 35 | require 'coderay' |
|
36 | 36 | require 'coderay/helpers/file_type' |
|
37 | 37 | |
|
38 | 38 | class << self |
|
39 | 39 | # Highlights +text+ as the content of +filename+ |
|
40 | 40 | # Should not return line numbers nor outer pre tag |
|
41 | 41 | def highlight_by_filename(text, filename) |
|
42 | 42 | language = ::CodeRay::FileType[filename] |
|
43 | 43 | language ? ::CodeRay.scan(text, language).html : ERB::Util.h(text) |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | # Highlights +text+ using +language+ syntax |
|
47 | 47 | # Should not return outer pre tag |
|
48 | 48 | def highlight_by_language(text, language) |
|
49 | ::CodeRay.scan(text, language).html(:line_numbers => :inline) | |
|
49 | ::CodeRay.scan(text, language).html(:line_numbers => :inline, :wrap => :span) | |
|
50 | 50 | end |
|
51 | 51 | end |
|
52 | 52 | end |
|
53 | 53 | end |
|
54 | 54 | |
|
55 | 55 | SyntaxHighlighting.highlighter = 'CodeRay' |
|
56 | 56 | end |
@@ -1,172 +1,195 | |||
|
1 | 1 | |
|
2 | 2 | div.changeset-changes ul { margin: 0; padding: 0; } |
|
3 | 3 | div.changeset-changes ul > ul { margin-left: 18px; padding: 0; } |
|
4 | 4 | |
|
5 | 5 | li.change { |
|
6 | 6 | list-style-type:none; |
|
7 | 7 | background-image: url(../images/bullet_black.png); |
|
8 | 8 | background-position: 1px 1px; |
|
9 | 9 | background-repeat: no-repeat; |
|
10 | 10 | padding-top: 1px; |
|
11 | 11 | padding-bottom: 1px; |
|
12 | 12 | padding-left: 20px; |
|
13 | 13 | margin: 0; |
|
14 | 14 | } |
|
15 | 15 | li.change.folder { background-image: url(../images/folder_open.png); } |
|
16 | 16 | li.change.folder.change-A { background-image: url(../images/folder_open_add.png); } |
|
17 | 17 | li.change.folder.change-M { background-image: url(../images/folder_open_orange.png); } |
|
18 | 18 | li.change.change-A { background-image: url(../images/bullet_add.png); } |
|
19 | 19 | li.change.change-M { background-image: url(../images/bullet_orange.png); } |
|
20 | 20 | li.change.change-C { background-image: url(../images/bullet_blue.png); } |
|
21 | 21 | li.change.change-R { background-image: url(../images/bullet_purple.png); } |
|
22 | 22 | li.change.change-D { background-image: url(../images/bullet_delete.png); } |
|
23 | 23 | |
|
24 | 24 | li.change .copied-from { font-style: italic; color: #999; font-size: 0.9em; } |
|
25 | 25 | li.change .copied-from:before { content: " - "} |
|
26 | 26 | |
|
27 | 27 | #changes-legend { float: right; font-size: 0.8em; margin: 0; } |
|
28 | 28 | #changes-legend li { float: left; background-position: 5px 0; } |
|
29 | 29 | |
|
30 | 30 | table.filecontent { border: 1px solid #ccc; border-collapse: collapse; width:98%; background-color: #fafafa; } |
|
31 | 31 | table.filecontent th { border: 1px solid #ccc; background-color: #eee; } |
|
32 | 32 | table.filecontent th.filename { background-color: #e4e4d4; text-align: left; padding: 0.2em;} |
|
33 | 33 | table.filecontent tr.spacing th { text-align:center; } |
|
34 | 34 | table.filecontent tr.spacing td { height: 0.4em; background: #EAF2F5;} |
|
35 | 35 | table.filecontent th.line-num { |
|
36 | 36 | border: 1px solid #d7d7d7; |
|
37 | 37 | font-size: 0.8em; |
|
38 | 38 | text-align: right; |
|
39 | 39 | width: 2%; |
|
40 | 40 | padding-right: 3px; |
|
41 | 41 | color: #999; |
|
42 | 42 | } |
|
43 | 43 | table.filecontent th.line-num a { |
|
44 | 44 | text-decoration: none; |
|
45 | 45 | color: inherit; |
|
46 | 46 | } |
|
47 | 47 | table.filecontent td.line-code pre { |
|
48 | 48 | margin: 0px; |
|
49 | 49 | white-space: pre-wrap; /* CSS2.1 compliant */ |
|
50 | 50 | white-space: -moz-pre-wrap; /* Mozilla-based browsers */ |
|
51 | 51 | white-space: -o-pre-wrap; /* Opera 7+ */ |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | /* 12 different colors for the annonate view */ |
|
55 | 55 | table.annotate tr.bloc-0 {background: #FFFFBF;} |
|
56 | 56 | table.annotate tr.bloc-1 {background: #EABFFF;} |
|
57 | 57 | table.annotate tr.bloc-2 {background: #BFFFFF;} |
|
58 | 58 | table.annotate tr.bloc-3 {background: #FFD9BF;} |
|
59 | 59 | table.annotate tr.bloc-4 {background: #E6FFBF;} |
|
60 | 60 | table.annotate tr.bloc-5 {background: #BFCFFF;} |
|
61 | 61 | table.annotate tr.bloc-6 {background: #FFBFEF;} |
|
62 | 62 | table.annotate tr.bloc-7 {background: #FFE6BF;} |
|
63 | 63 | table.annotate tr.bloc-8 {background: #FFE680;} |
|
64 | 64 | table.annotate tr.bloc-9 {background: #AA80FF;} |
|
65 | 65 | table.annotate tr.bloc-10 {background: #FFBFDC;} |
|
66 | 66 | table.annotate tr.bloc-11 {background: #BFE4FF;} |
|
67 | 67 | |
|
68 | 68 | table.annotate td.revision { |
|
69 | 69 | text-align: center; |
|
70 | 70 | width: 2%; |
|
71 | 71 | padding-left: 1em; |
|
72 | 72 | background: inherit; |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | table.annotate td.author { |
|
76 | 76 | text-align: center; |
|
77 | 77 | border-right: 1px solid #d7d7d7; |
|
78 | 78 | white-space: nowrap; |
|
79 | 79 | padding-left: 1em; |
|
80 | 80 | padding-right: 1em; |
|
81 | 81 | width: 3%; |
|
82 | 82 | background: inherit; |
|
83 | 83 | font-size: 90%; |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | table.annotate td.line-code { background-color: #fafafa; } |
|
87 | 87 | |
|
88 | 88 | div.action_M { background: #fd8 } |
|
89 | 89 | div.action_D { background: #f88 } |
|
90 | 90 | div.action_A { background: #bfb } |
|
91 | 91 | |
|
92 | 92 | /************* CodeRay styles *************/ |
|
93 | ||
|
93 | .syntaxhl div {display: inline;} | |
|
94 | 94 | .syntaxhl .no { padding: 2px 4px 2px 4px; background-color: #eee; margin:0 } |
|
95 | 95 | .syntaxhl .code pre { overflow: auto } |
|
96 | 96 | .syntaxhl .debug { color:white ! important; background:blue ! important; } |
|
97 | 97 | |
|
98 | 98 | .syntaxhl .af { color:#00C } |
|
99 | 99 | .syntaxhl .an { color:#007 } |
|
100 | .syntaxhl .at { color:#f08 } | |
|
100 | 101 | .syntaxhl .av { color:#700 } |
|
101 | 102 | .syntaxhl .aw { color:#C00 } |
|
102 | 103 | .syntaxhl .bi { color:#509; font-weight:bold } |
|
103 |
.syntaxhl .c { color:# |
|
|
104 | .syntaxhl .c { color:#888; } | |
|
104 | 105 | |
|
105 | 106 | .syntaxhl .ch { color:#04D } |
|
106 | 107 | .syntaxhl .ch .k { color:#04D } |
|
107 | 108 | .syntaxhl .ch .dl { color:#039 } |
|
108 | 109 | |
|
109 | 110 | .syntaxhl .cl { color:#B06; font-weight:bold } |
|
111 | .syntaxhl .cm { color:#A08; font-weight:bold } | |
|
110 | 112 | .syntaxhl .co { color:#036; font-weight:bold } |
|
111 | 113 | .syntaxhl .cr { color:#0A0 } |
|
112 | 114 | .syntaxhl .cv { color:#369 } |
|
115 | .syntaxhl .de { color:#B0B; } | |
|
113 | 116 | .syntaxhl .df { color:#099; font-weight:bold } |
|
114 | 117 | .syntaxhl .di { color:#088; font-weight:bold } |
|
115 | 118 | .syntaxhl .dl { color:black } |
|
116 | 119 | .syntaxhl .do { color:#970 } |
|
120 | .syntaxhl .dt { color:#34b } | |
|
117 | 121 | .syntaxhl .ds { color:#D42; font-weight:bold } |
|
118 | 122 | .syntaxhl .e { color:#666; font-weight:bold } |
|
119 | 123 | .syntaxhl .en { color:#800; font-weight:bold } |
|
120 | 124 | .syntaxhl .er { color:#F00; background-color:#FAA } |
|
121 |
.syntaxhl .ex { color:# |
|
|
125 | .syntaxhl .ex { color:#C00; font-weight:bold } | |
|
122 | 126 | .syntaxhl .fl { color:#60E; font-weight:bold } |
|
123 | 127 | .syntaxhl .fu { color:#06B; font-weight:bold } |
|
124 | 128 | .syntaxhl .gv { color:#d70; font-weight:bold } |
|
125 | 129 | .syntaxhl .hx { color:#058; font-weight:bold } |
|
126 | 130 | .syntaxhl .i { color:#00D; font-weight:bold } |
|
127 | 131 | .syntaxhl .ic { color:#B44; font-weight:bold } |
|
128 | 132 | |
|
129 |
.syntaxhl .il { background: # |
|
|
130 |
.syntaxhl .il .il { background: # |
|
|
131 |
.syntaxhl .il .il .il { background: # |
|
|
132 |
.syntaxhl .il .idl { font-weight: bold; color: # |
|
|
133 | .syntaxhl .il { background: #ddd; color: black } | |
|
134 | .syntaxhl .il .il { background: #ccc } | |
|
135 | .syntaxhl .il .il .il { background: #bbb } | |
|
136 | .syntaxhl .il .idl { background: #ddd; font-weight: bold; color: #666 } | |
|
137 | .syntaxhl .idl { background-color: #bbb; font-weight: bold; color: #666; } | |
|
133 | 138 | |
|
139 | .syntaxhl .im { color:#f00; } | |
|
134 | 140 | .syntaxhl .in { color:#B2B; font-weight:bold } |
|
135 | 141 | .syntaxhl .iv { color:#33B } |
|
136 | 142 | .syntaxhl .la { color:#970; font-weight:bold } |
|
137 | 143 | .syntaxhl .lv { color:#963 } |
|
138 | 144 | .syntaxhl .oc { color:#40E; font-weight:bold } |
|
139 | 145 | .syntaxhl .of { color:#000; font-weight:bold } |
|
140 | 146 | .syntaxhl .op { } |
|
141 | 147 | .syntaxhl .pc { color:#038; font-weight:bold } |
|
142 | 148 | .syntaxhl .pd { color:#369; font-weight:bold } |
|
143 | .syntaxhl .pp { color:#579 } | |
|
144 |
.syntaxhl .p |
|
|
145 |
.syntaxhl . |
|
|
149 | .syntaxhl .pp { color:#579; } | |
|
150 | .syntaxhl .ps { color:#00C; font-weight:bold } | |
|
151 | .syntaxhl .pt { color:#074; font-weight:bold } | |
|
152 | .syntaxhl .r, .kw { color:#080; font-weight:bold } | |
|
153 | ||
|
154 | .syntaxhl .ke { color: #808; } | |
|
155 | .syntaxhl .ke .dl { color: #606; } | |
|
156 | .syntaxhl .ke .ch { color: #80f; } | |
|
157 | .syntaxhl .vl { color: #088; } | |
|
146 | 158 | |
|
147 | 159 | .syntaxhl .rx { background-color:#fff0ff } |
|
148 | 160 | .syntaxhl .rx .k { color:#808 } |
|
149 | 161 | .syntaxhl .rx .dl { color:#404 } |
|
150 | 162 | .syntaxhl .rx .mod { color:#C2C } |
|
151 | 163 | .syntaxhl .rx .fu { color:#404; font-weight: bold } |
|
152 | 164 | |
|
153 |
.syntaxhl .s |
|
|
165 | .syntaxhl .s { background-color:#fff0f0; color: #D20; } | |
|
154 | 166 |
.syntaxhl .s |
|
155 | 167 |
.syntaxhl .s |
|
156 |
.syntaxhl .s |
|
|
157 |
.syntaxhl .s |
|
|
168 | .syntaxhl .s .k { } | |
|
169 | .syntaxhl .s .ch { color: #b0b; } | |
|
170 | .syntaxhl .s .dl { color: #710; } | |
|
158 | 171 | |
|
159 | .syntaxhl .sh { background-color:#f0fff0 } | |
|
160 |
.syntaxhl .sh .k { |
|
|
172 | .syntaxhl .sh { background-color:#f0fff0; color:#2B2 } | |
|
173 | .syntaxhl .sh .k { } | |
|
161 | 174 | .syntaxhl .sh .dl { color:#161 } |
|
162 | 175 | |
|
163 | 176 | .syntaxhl .sy { color:#A60 } |
|
164 | 177 | .syntaxhl .sy .k { color:#A60 } |
|
165 | 178 | .syntaxhl .sy .dl { color:#630 } |
|
166 | 179 | |
|
167 | 180 | .syntaxhl .ta { color:#070 } |
|
168 | 181 | .syntaxhl .tf { color:#070; font-weight:bold } |
|
169 | 182 | .syntaxhl .ts { color:#D70; font-weight:bold } |
|
170 | 183 | .syntaxhl .ty { color:#339; font-weight:bold } |
|
171 | 184 | .syntaxhl .v { color:#036 } |
|
172 | 185 | .syntaxhl .xt { color:#444 } |
|
186 | ||
|
187 | .syntaxhl .ins { background: #cfc; } | |
|
188 | .syntaxhl .del { background: #fcc; } | |
|
189 | .syntaxhl .chg { color: #aaf; background: #007; } | |
|
190 | .syntaxhl .head { color: #f8f; background: #505 } | |
|
191 | ||
|
192 | .syntaxhl .ins .ins { color: #080; font-weight:bold } | |
|
193 | .syntaxhl .del .del { color: #800; font-weight:bold } | |
|
194 | .syntaxhl .chg .chg { color: #66f; } | |
|
195 | .syntaxhl .head .head { color: #f4f; } |
General Comments 0
You need to be logged in to leave comments.
Login now