trainbbcode 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/Manifest +44 -0
  2. data/Rakefile +2 -1
  3. data/init.rb +1 -0
  4. data/lib/trainbbcode.rb +66 -29
  5. data/rails_generators/syntaxhighlighter/syntaxhighlighter_generator.rb +30 -0
  6. data/rails_generators/syntaxhighlighter/templates/scripts/clipboard.swf +0 -0
  7. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushAS3.js +61 -0
  8. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushBash.js +66 -0
  9. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCSharp.js +67 -0
  10. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushColdFusion.js +102 -0
  11. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCpp.js +99 -0
  12. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCss.js +93 -0
  13. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushDelphi.js +57 -0
  14. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushDiff.js +43 -0
  15. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushErlang.js +54 -0
  16. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushGroovy.js +69 -0
  17. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJScript.js +52 -0
  18. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJava.js +59 -0
  19. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJavaFX.js +60 -0
  20. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPerl.js +74 -0
  21. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPhp.js +91 -0
  22. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPlain.js +35 -0
  23. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPowerShell.js +76 -0
  24. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPython.js +66 -0
  25. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushRuby.js +57 -0
  26. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushScala.js +53 -0
  27. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushSql.js +68 -0
  28. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushVb.js +58 -0
  29. data/rails_generators/syntaxhighlighter/templates/scripts/shBrushXml.js +71 -0
  30. data/rails_generators/syntaxhighlighter/templates/scripts/shCore.js +30 -0
  31. data/rails_generators/syntaxhighlighter/templates/scripts/shLegacy.js +30 -0
  32. data/rails_generators/syntaxhighlighter/templates/src/shCore.js +2077 -0
  33. data/rails_generators/syntaxhighlighter/templates/src/shLegacy.js +172 -0
  34. data/rails_generators/syntaxhighlighter/templates/styles/help.png +0 -0
  35. data/rails_generators/syntaxhighlighter/templates/styles/magnifier.png +0 -0
  36. data/rails_generators/syntaxhighlighter/templates/styles/page_white_code.png +0 -0
  37. data/rails_generators/syntaxhighlighter/templates/styles/page_white_copy.png +0 -0
  38. data/rails_generators/syntaxhighlighter/templates/styles/printer.png +0 -0
  39. data/rails_generators/syntaxhighlighter/templates/styles/shCore.css +330 -0
  40. data/rails_generators/syntaxhighlighter/templates/styles/shThemeDefault.css +173 -0
  41. data/rails_generators/syntaxhighlighter/templates/styles/shThemeDjango.css +176 -0
  42. data/rails_generators/syntaxhighlighter/templates/styles/shThemeEclipse.css +190 -0
  43. data/rails_generators/syntaxhighlighter/templates/styles/shThemeEmacs.css +175 -0
  44. data/rails_generators/syntaxhighlighter/templates/styles/shThemeFadeToGrey.css +177 -0
  45. data/rails_generators/syntaxhighlighter/templates/styles/shThemeMidnight.css +175 -0
  46. data/rails_generators/syntaxhighlighter/templates/styles/shThemeRDark.css +175 -0
  47. data/trainbbcode.gemspec +6 -3
  48. metadata +56 -4
@@ -0,0 +1,172 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ var dp = {
31
+ SyntaxHighlighter : {}
32
+ };
33
+
34
+ dp.SyntaxHighlighter = {
35
+ parseParams: function(
36
+ input,
37
+ showGutter,
38
+ showControls,
39
+ collapseAll,
40
+ firstLine,
41
+ showColumns
42
+ )
43
+ {
44
+ function getValue(list, name)
45
+ {
46
+ var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
47
+ match = null
48
+ ;
49
+
50
+ for (var i = 0; i < list.length; i++)
51
+ if ((match = regex.exec(list[i])) != null)
52
+ return match.value;
53
+
54
+ return null;
55
+ };
56
+
57
+ function defaultValue(value, def)
58
+ {
59
+ return value != null ? value : def;
60
+ };
61
+
62
+ function asString(value)
63
+ {
64
+ return value != null ? value.toString() : null;
65
+ };
66
+
67
+ var parts = input.split(':'),
68
+ brushName = parts[0],
69
+ options = {},
70
+ straight = { 'true' : 'true' }
71
+ reverse = { 'true' : 'false' },
72
+ result = null,
73
+ defaults = SyntaxHighlighter.defaults
74
+ ;
75
+
76
+ for (var i in parts)
77
+ options[parts[i]] = 'true';
78
+
79
+ showGutter = asString(defaultValue(showGutter, defaults.gutter));
80
+ showControls = asString(defaultValue(showControls, defaults.toolbar));
81
+ collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
82
+ showColumns = asString(defaultValue(showColumns, defaults.ruler));
83
+ firstLine = asString(defaultValue(firstLine, defaults['first-line']));
84
+
85
+ result = {
86
+ brush : brushName,
87
+ gutter : defaultValue(reverse[options.nogutter], showGutter),
88
+ toolbar : defaultValue(reverse[options.nocontrols], showControls),
89
+ collapse : defaultValue(straight[options.collapse], collapseAll),
90
+ ruler : defaultValue(straight[options.showcolumns], showColumns),
91
+ 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
92
+ };
93
+
94
+ return result;
95
+ },
96
+
97
+ HighlightAll: function(
98
+ name,
99
+ showGutter /* optional */,
100
+ showControls /* optional */,
101
+ collapseAll /* optional */,
102
+ firstLine /* optional */,
103
+ showColumns /* optional */
104
+ )
105
+ {
106
+ function findValue()
107
+ {
108
+ var a = arguments;
109
+
110
+ for (var i = 0; i < a.length; i++)
111
+ {
112
+ if (a[i] === null)
113
+ continue;
114
+
115
+ if (typeof(a[i]) == 'string' && a[i] != '')
116
+ return a[i] + '';
117
+
118
+ if (typeof(a[i]) == 'object' && a[i].value != '')
119
+ return a[i].value + '';
120
+ }
121
+
122
+ return null;
123
+ };
124
+
125
+ function findTagsByName(list, name, tagName)
126
+ {
127
+ var tags = document.getElementsByTagName(tagName);
128
+
129
+ for (var i = 0; i < tags.length; i++)
130
+ if (tags[i].getAttribute('name') == name)
131
+ list.push(tags[i]);
132
+ }
133
+
134
+ var elements = [],
135
+ highlighter = null,
136
+ registered = {},
137
+ propertyName = 'innerHTML'
138
+ ;
139
+
140
+ // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
141
+ findTagsByName(elements, name, 'pre');
142
+ findTagsByName(elements, name, 'textarea');
143
+
144
+ if (elements.length === 0)
145
+ return;
146
+
147
+ for (var i = 0; i < elements.length; i++)
148
+ {
149
+ var element = elements[i],
150
+ params = findValue(
151
+ element.attributes['class'], element.className,
152
+ element.attributes['language'], element.language
153
+ ),
154
+ language = ''
155
+ ;
156
+
157
+ if (params === null)
158
+ continue;
159
+
160
+ params = dp.SyntaxHighlighter.parseParams(
161
+ params,
162
+ showGutter,
163
+ showControls,
164
+ collapseAll,
165
+ firstLine,
166
+ showColumns
167
+ );
168
+
169
+ SyntaxHighlighter.highlight(params, element);
170
+ }
171
+ }
172
+ };
@@ -0,0 +1,330 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ .syntaxhighlighter,
31
+ .syntaxhighlighter div,
32
+ .syntaxhighlighter code,
33
+ .syntaxhighlighter table,
34
+ .syntaxhighlighter table td,
35
+ .syntaxhighlighter table tr,
36
+ .syntaxhighlighter table tbody
37
+ {
38
+ margin: 0 !important;
39
+ padding: 0 !important;
40
+ border: 0 !important;
41
+ outline: 0 !important;
42
+ background: none !important;
43
+ text-align: left !important;
44
+ float: none !important;
45
+ vertical-align: baseline !important;
46
+ position: static !important;
47
+ left: auto !important;
48
+ top: auto !important;
49
+ right: auto !important;
50
+ bottom: auto !important;
51
+ height: auto !important;
52
+ width: auto !important;
53
+ line-height: 1.1em !important;
54
+ font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
55
+ font-weight: normal !important;
56
+ font-style: normal !important;
57
+ font-size: 1em !important;
58
+ min-height: inherit !important; /* For IE8, FF & WebKit */
59
+ min-height: auto !important; /* For IE7 */
60
+ }
61
+
62
+ .syntaxhighlighter
63
+ {
64
+ width: 99% !important; /* 99% fixes IE8 horizontal scrollbar */
65
+ margin: 1em 0 1em 0 !important;
66
+ padding: 1px !important; /* adds a little border on top and bottom */
67
+ position: relative !important;
68
+ }
69
+
70
+ .syntaxhighlighter .bold
71
+ {
72
+ font-weight: bold !important;
73
+ }
74
+
75
+ .syntaxhighlighter .italic
76
+ {
77
+ font-style: italic !important;
78
+ }
79
+
80
+ .syntaxhighlighter .line
81
+ {
82
+ }
83
+
84
+ .syntaxhighlighter .no-wrap .line .content
85
+ {
86
+ white-space: pre !important;
87
+ }
88
+
89
+ .syntaxhighlighter .line table
90
+ {
91
+ border-collapse: collapse !important;
92
+ }
93
+
94
+ .syntaxhighlighter .line td
95
+ {
96
+ vertical-align: top !important;
97
+ }
98
+
99
+ .syntaxhighlighter .line .number
100
+ {
101
+ width: 3em !important;
102
+ }
103
+
104
+ .syntaxhighlighter .line .number code
105
+ {
106
+ width: 2.7em !important;
107
+ padding-right: .3em !important;
108
+ text-align: right !important;
109
+ display: block !important;
110
+ }
111
+
112
+ .syntaxhighlighter .line .content
113
+ {
114
+ padding-left: .5em !important;
115
+ }
116
+
117
+ .syntaxhighlighter .line .spaces
118
+ {
119
+ }
120
+
121
+ /* Disable border and margin on the lines when no gutter option is set */
122
+ .syntaxhighlighter.nogutter .line .content
123
+ {
124
+ border-left: none !important;
125
+ }
126
+
127
+ .syntaxhighlighter .bar
128
+ {
129
+ display: none !important;
130
+ }
131
+
132
+ .syntaxhighlighter .bar.show
133
+ {
134
+ display: block !important;
135
+ }
136
+
137
+ .syntaxhighlighter.collapsed .bar
138
+ {
139
+ display: block !important;
140
+ }
141
+
142
+ /* Adjust some properties when collapsed */
143
+
144
+ .syntaxhighlighter.collapsed .lines
145
+ {
146
+ display: none !important;
147
+ }
148
+
149
+ .syntaxhighlighter .lines.no-wrap
150
+ {
151
+ overflow: auto !important;
152
+ overflow-y: hidden !important;
153
+ }
154
+
155
+ /* Styles for the toolbar */
156
+
157
+ .syntaxhighlighter .toolbar
158
+ {
159
+ position: absolute !important;
160
+ right: 0px !important;
161
+ top: 0px !important;
162
+ font-size: 1px !important;
163
+ padding: 8px 8px 8px 0 !important; /* in px because images don't scale with ems */
164
+ }
165
+
166
+ .syntaxhighlighter.collapsed .toolbar
167
+ {
168
+ font-size: 80% !important;
169
+ padding: .2em 0 .5em .5em !important;
170
+ position: static !important;
171
+ }
172
+
173
+ .syntaxhighlighter .toolbar a.item,
174
+ .syntaxhighlighter .toolbar .item
175
+ {
176
+ display: block !important;
177
+ float: left !important;
178
+ margin-left: 8px !important;
179
+ background-repeat: no-repeat !important;
180
+ overflow: hidden !important;
181
+ text-indent: -5000px !important;
182
+ }
183
+
184
+ .syntaxhighlighter.collapsed .toolbar .item
185
+ {
186
+ display: none !important;
187
+ }
188
+
189
+ .syntaxhighlighter.collapsed .toolbar .item.expandSource
190
+ {
191
+ background-image: url(magnifier.png) !important;
192
+ display: inline !important;
193
+ text-indent: 0 !important;
194
+ width: auto !important;
195
+ float: none !important;
196
+ height: 16px !important;
197
+ padding-left: 20px !important;
198
+ }
199
+
200
+ .syntaxhighlighter .toolbar .item.viewSource
201
+ {
202
+ background-image: url(page_white_code.png) !important;
203
+ }
204
+
205
+ .syntaxhighlighter .toolbar .item.printSource
206
+ {
207
+ background-image: url(printer.png) !important;
208
+ }
209
+
210
+ .syntaxhighlighter .toolbar .item.copyToClipboard
211
+ {
212
+ text-indent: 0 !important;
213
+ background: none !important;
214
+ overflow: visible !important;
215
+ }
216
+
217
+ .syntaxhighlighter .toolbar .item.about
218
+ {
219
+ background-image: url(help.png) !important;
220
+ }
221
+
222
+ /**
223
+ * Print view.
224
+ * Colors are based on the default theme without background.
225
+ */
226
+
227
+ .syntaxhighlighter.printing,
228
+ .syntaxhighlighter.printing .line.alt1 .content,
229
+ .syntaxhighlighter.printing .line.alt2 .content,
230
+ .syntaxhighlighter.printing .line.highlighted .number,
231
+ .syntaxhighlighter.printing .line.highlighted.alt1 .content,
232
+ .syntaxhighlighter.printing .line.highlighted.alt2 .content,
233
+ {
234
+ background: none !important;
235
+ }
236
+
237
+ /* Gutter line numbers */
238
+ .syntaxhighlighter.printing .line .number
239
+ {
240
+ color: #bbb !important;
241
+ }
242
+
243
+ /* Add border to the lines */
244
+ .syntaxhighlighter.printing .line .content
245
+ {
246
+ color: #000 !important;
247
+ }
248
+
249
+ /* Toolbar when visible */
250
+ .syntaxhighlighter.printing .toolbar
251
+ {
252
+ display: none !important;
253
+ }
254
+
255
+ .syntaxhighlighter.printing a
256
+ {
257
+ text-decoration: none !important;
258
+ }
259
+
260
+ .syntaxhighlighter.printing .plain,
261
+ .syntaxhighlighter.printing .plain a
262
+ {
263
+ color: #000 !important;
264
+ }
265
+
266
+ .syntaxhighlighter.printing .comments,
267
+ .syntaxhighlighter.printing .comments a
268
+ {
269
+ color: #008200 !important;
270
+ }
271
+
272
+ .syntaxhighlighter.printing .string,
273
+ .syntaxhighlighter.printing .string a
274
+ {
275
+ color: blue !important;
276
+ }
277
+
278
+ .syntaxhighlighter.printing .keyword
279
+ {
280
+ color: #069 !important;
281
+ font-weight: bold !important;
282
+ }
283
+
284
+ .syntaxhighlighter.printing .preprocessor
285
+ {
286
+ color: gray !important;
287
+ }
288
+
289
+ .syntaxhighlighter.printing .variable
290
+ {
291
+ color: #a70 !important;
292
+ }
293
+
294
+ .syntaxhighlighter.printing .value
295
+ {
296
+ color: #090 !important;
297
+ }
298
+
299
+ .syntaxhighlighter.printing .functions
300
+ {
301
+ color: #ff1493 !important;
302
+ }
303
+
304
+ .syntaxhighlighter.printing .constants
305
+ {
306
+ color: #0066CC !important;
307
+ }
308
+
309
+ .syntaxhighlighter.printing .script
310
+ {
311
+ font-weight: bold !important;
312
+ }
313
+
314
+ .syntaxhighlighter.printing .color1,
315
+ .syntaxhighlighter.printing .color1 a
316
+ {
317
+ color: #808080 !important;
318
+ }
319
+
320
+ .syntaxhighlighter.printing .color2,
321
+ .syntaxhighlighter.printing .color2 a
322
+ {
323
+ color: #ff1493 !important;
324
+ }
325
+
326
+ .syntaxhighlighter.printing .color3,
327
+ .syntaxhighlighter.printing .color3 a
328
+ {
329
+ color: red !important;
330
+ }