Debian Codegraph @

Changes.textile

raw
1 h1=. CodeRay Version History
2
3 p=. _This files lists all changes in the CodeRay library since the 0.9.8 release._
4
5 h2. Changes in 1.1.3
6
7 * Tokens: Ensure Ruby 2.6 compatibility. [#233, thanks to Jun Aruga]
8 * SQL scanner: Add @numeric@ data type. [#223, thanks to m16a1]
9 * Java scanner: Add @var@ as type. [#229, thanks to Davide Angelocola]
10 * Gem: Fix deprecation warning. [#246, thanks to David Rodríguez]
11
12 h2. Changes in 1.1.2
13
14 * Ruby future: Add support for frozen string literals. [#211, thanks to Pat Allan]
15 * C++ scanner: Add C++11 keywords. [#195, thanks to Johnny Willemsen]
16 * Haml scanner: Allow @-@ in tags.
17 * Java scanner: Allow Unicode characters in identifiers. [#212, thanks to t-gergely]
18
19 h2. Changes in 1.1.1
20
21 * SQL scanner: Allow @$@ signs in SQL identifiers [#164, thanks to jasir and Ben Basson]
22 * SQL scanner: Fix open strings [#163, thanks to Adam]
23 * Ruby scanner: Accept number literal suffixes @r@ and @i@ (Ruby 2.1)
24 * Ruby scanner: Accept quoted hash keys like @{ "a": boss }@ (Ruby 2.2)
25 * Ruby scanner: Accept save navigation operator @&.@ (Ruby 2.3)
26 * Ruby scanner: Accept squiggly heredoc @<<~@ (Ruby 2.3)
27 * Diff scanner: Prevent running out of regexp stack.
28 * HTML encoder: You can keep tabs intact now by setting @tab_width: false@.
29 * Alpha style: Tweaked colors for @:function@ group with @:content@.
30 * File structure: One module per file, autoload CodeRay::Version, paths follow namespace hierarchy.
31
32 h2. Changes in 1.1
33
34 New scanners:
35
36 * Go [#28, thanks to Eric Guo and Nathan Youngman]
37 * Lua [#21, #22, thanks to Quintus]
38 * Sass [#93]
39 * Taskpaper [#39, thanks to shimomura]
40
41 More new stuff:
42
43 * @.xaml@ file type [#121, thanks to Kozman Bálint]
44 * recognize @Guardfile@, @Vagrantfile@, and @Appraisals@ as Ruby files [#121, thanks to Kozman Bálint]
45 * new token kind @:id@ for CSS/Sass [#27]
46 * new token kind @:done@ for Taskpaper [#39]
47 * new token kind @:map@ for Lua, introducing a nice nested-shades trick [#22, thanks to Quintus and Nathan Youngman]
48 * new token kind @:unknown@ for Debug scanner
49 * new DebugLint encoder that checks for empty tokens and correct nesting
50
51 Improvements:
52
53 * CSS scanner uses @:id@ and @:tag@ now [#27]
54 * Diff scanner: Highlight inline changes in multi-line changes [#99]
55 * JavaScript scanner: Highlight multi-line comments in diff correctly
56 * JSON scanner: simplify key/value heuristic, using look-ahead instead of a stack
57 * HTML scanner displays style tags and attributes now [#145]
58 * Ruby scanner: Accept @%i(…)@ and @%I(…)@ symbol lists (Ruby 2.0) [thanks to Nathan Youngman]
59 * Ruby scanner: Accept keywords as Ruby hash keys [#126]
60 * performance improvements to several scanners and encoders, especially Terminal and HTML
61 * added @:keep_state@ functionality to more scanners so they work nicely with diff now [#116]
62 * refactoring and cleanup to achieve better "Code Climate" ratings (but I don't really care)
63 * updated and cleaned up the documentation,
64 * documented list of TokenKinds
65 * Alpha style: tweaked colors for @.binary@, @.local-variable@, and @.predefined-type@
66 * @rake generate@ supports Git now instead of Subversion
67
68 Removed:
69
70 * @Tokens#dump@, @Tokens.load@, @Tokens::Undumping@, and @zlib@ dependency
71 * double-click toggle handler from HTML table output
72 * @rake_helpers@, @sample@ directories and several other ancient garbage
73
74 Fixes:
75
76 * fixes to CSS scanner (floats, pseudoclasses, nth-child) [#143]
77 * fixed empty tokens and unclosed token groups in HTML, CSS, Diff, Goovy, PHP, Raydebug, Ruby, SQL, and YAML scanners [#144]
78 * fixed @:docstring@ token type style
79 * fixed several infinite Hash caches and dynamic Symbol creation that might have been exploited by an attacker [#148]
80 * fixed HTML encoder when output is a StringIO (eg. when using @-HTML@ as a command line parameter)
81 * TokenKinds should not be frozen [#130, thanks to Gavin Kistner]
82 * display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom]
83 * override Bootstrap's @pre { word-break: break-all }@ styling for line numbers [#102, thanks to lightswitch05]
84 * HTML encoder will not warn about unclosed token groups at the end of the stream
85 * fixed problem with coderay/version.rb being loaded twice
86
87 Internals:
88
89 * The Debug scanner maps unknown token kinds to @:unknown@ (to avoid creating Symbols based on possibly unsafe input).
90 * The Raydebug scanner highlights unknown token kinds as @:plain@.
91 * The Debug encoder refactored; use DebugLint if you want strict checking now..
92 * The Debug encoder will not warn about errors in the token stream.
93 * Plugin does not warn about fallback when default is defined.
94 * PluginHost now works with Strings instead of Symbols internally (to avoid using @#to_sym@).
95
96 h2. Changes in 1.0.9
97
98 * Fix Ruby scanner: Ruby 1.9 hash syntax @{ key: value }@ is highlighted correctly. [GH #106, thanks to Seth Vargo]
99 * Fix HTML scanner: Accept DTDs. [GH #83]
100 * Fix PHP scanner: Accept Unicode. [GH #40, thanks to Lance Li]
101
102 h2. Changes in 1.0.8
103
104 * add @:string/:char@, remove @:regexp/:function@ color from Terminal encoder [GH #29, thanks to Kyrylo Silin]
105 * allow @-@ in line number anchor prefix for HTML encoder [GH #32, thanks to shurizzle]
106 * Fix HTML scanner: Don't crash if HTML in a diff contains a JavaScript tag.
107
108 h2. Changes in 1.0.7
109
110 * Changed license from LGPL to MIT. [GH-25, thanks to jessehu]
111 * Fix issue with plugin files not being loaded. [GH-20, thanks to Will Read]
112 * Fix HTML scanner bug: Don't choke on boolean attributes. [GH-26, thanks to jugglinmike]
113
114 h2. Changes in 1.0.6
115
116 * New option @:break_lines@ for the HTML encoder (splits tokens at line breaks). [GH-15, thanks to Etienne Massip]
117 * Improved speed of @:line_numbers => :inline@ option for the HTML encoder.
118 * Fixed wrong HTML file type. (was @:page@) [GH-16, thanks to Doug Hammond]
119 * The CSS Scanner now highlights tokens like @url(...)@ as @:function@ instead of @:string@. [GH-13, thanks to Joel Holdbrooks]
120
121 h2. Changes in 1.0.5
122
123 Fixes:
124
125 * @autoload@ calls do not depend on @coderay/lib@ being in the load path (GitHub issue #6; thanks to tvon, banister, envygeeks, and ConradIrwin)
126 * avoid dark blue as terminal color (GitHub issue #9; thanks to shevegen)
127
128 h2. Changes in 1.0.4
129
130 Fixes in the CSS scanner:
131
132 * understands the unit "s" (seconds)
133 * ignores unexpected curly braces
134 * code inside of diffs is highlighted correctly
135
136 h2. Changes in 1.0.3
137
138 New:
139
140 * .tmproj files are recognized as XML.
141
142 Fixes:
143
144 * Removed files are highlighted inside diffs generated by git.
145
146 h2. Changes in 1.0.2
147
148 Fixes:
149
150 * .erb files are recognized as ERB.
151
152 h2. Changes in 1.0.1
153
154 New:
155
156 * YAML scanner allows "-" and "/" in key names
157
158 Changes:
159
160 * HTML page output has no white border anymore (alpha style)
161
162 Fixes:
163
164 * fixed warning in the output of "coderay stylesheet"
165 * fixed additional scrollbar in code when last line contains an eyecatcher
166 * minor fixes in the tests (issue github-#4)
167
168 h2. Changes in 1.0
169
170 CodeRay 1.0 is a major rewrite of the library, and incompatible to earlier versions.
171
172 The command line and programmer interfaces are similar to 0.9, but the internals have completely changed.
173
174 h3. General changes
175
176 * *NEW*: The new Diff scanner colorizes code inside of the diff, and highlights inline changes.
177 * *NEW*: Extended support and usage of HTML5 and CSS 3 features.
178 * *NEW*: Direct Streaming
179 * *NEW* scanners: Clojure and HAML
180 * *CHANGED*: Token classes (used as CSS classes) are readable names; breaks you stylesheet!
181 * *IMPROVED* documentation
182 * *IMPROVED* speed: faster startup (using @autoload@), scanning, and encoding
183 * *IMPROVED* Ruby 1.9 encodings support
184 * *IMPROVED* Tests: There are more of them now!
185
186 h3. Direct Streaming
187
188 CodeRay 1.0 introduces _Direct Streaming_ as a faster and simpler alternative to Tokens. It means that all Scanners,
189 Encoders and Filters had to be rewritten, and that older scanners using the Tokens API are no longer compatible with
190 this version.
191
192 The main benefits of this change are:
193
194 * more speed (benchmarks show 10% to 50% more tokens per second compared to CodeRay 0.9)
195 * the ability to stream output into a pipe on the command line
196 * a simpler API
197 * less code
198
199 Changes related to the new tokens handling include:
200 * *CHANGED*: The Scanners now call Encoders directly; tokens are not added to a Tokens array, but are send to the
201 Encoder as a method call. The Tokens representation (which can be seen as a cache now) is still present, but as a
202 special case; Tokens just encodes the given tokens into an Array for later use.
203 * *CHANGED*: The token actions (@text_token@, @begin_group@ etc.) are now public methods of @Encoder@ and @Tokens@.
204 * *REWRITE* of all Scanners, Encoders, Filters, and Tokens.
205 * *RENAMED* @:open@ and @:close@ actions to @:begin_group@ and @:end_group@.
206 * *RENAMED* @open_token@ and @close_token@ methods to @begin_group@ and @end_group@.
207 * *NEW* method @#tokens@ allows to add several tokens to the stream. @Tokens@ and @Encoders::Encoder@ define this
208 method.
209 * *CHANGED* The above name changes also affect the JSON, XML, and YAML encoders. CodeRay 1.0 output will be incompatible
210 with earlier versions.
211 * *REMOVED* @TokenStream@ and the @Streamable@ API and all related features like @NotStreamableError@ are now obsolete
212 and have been removed.
213
214 h3. Command Line
215
216 The @coderay@ executable was rewritten and has a few new features:
217
218 * *NEW* Ability to stream into a pipe; try @coderay file | more -r@
219 * *NEW* help
220 * *IMPROVED*: more consistent parameter handling
221 * *REMOVED* @coderay_stylesheet@ executable; use @coderay stylesheet [name]@.
222
223 h3. @Tokens@
224
225 * *NEW* methods @count@, @begin_group@, @end_group@, @begin_line@, and @end_line@.
226 * *REMOVED* methods @#stream?@, @#each_text_token@.
227 * *REMOVED* methods @#optimize@, @#fix@, @#split_into_lines@ along with their bang! variants.
228 * *REMOVED* @#text@ and @#text_size@ methods. Use the @Text@ encoder instead.
229 * *REMOVED* special implementation of @#each@ taking a filter parameter. Use @TokenKindFilter@ instead.
230
231 h3. *RENAMED*: @TokenKinds@
232
233 Renamed from @Tokens::ClassOfKind@ (was also @Tokens::AbbreviationForKind@ for a while).
234 The term "token class" is no longer used in CodeRay. Instead, tokens have _kinds_.
235 See "#122":http://odd-eyed-code.org/issues/122.
236
237 * *CHANGED* all token CSS classes to readable names.
238 * *ADDED* token kinds @:filename@, @:namespace@, and @:eyecatcher@.
239 * *RENAMED* @:pre_constant@ and @:pre_type@ to @:predefined_constant@ and @predefined_type@.
240 * *RENAMED* @:oct@ and @:bin@ to @:octal@ and @binary@.
241 * *REMOVED* token kinds @:attribute_name_fat@, @:attribute_value_fat@, @:operator_fat@, @interpreted@,
242 @:tag_fat@, @tag_special@, @:xml_text@, @:nesting_delimiter@, @:open@, and @:close@.
243 * *CHANGED*: Don't raise error for unknown token kinds unless in @$CODERAY_DEBUG@ mode.
244 * *CHANGED* the value for a token kind that is not highlighted from
245 @:NO_HIGHLIGHT@ to @false@.
246
247 h3. @Duo@
248
249 * *NEW* method @call@ for allowing code like @CodeRay::Duo[:python => :yaml].(code)@ in Ruby 1.9.
250
251 h3. @Encoders::CommentFilter@
252
253 * *NEW* alias @:remove_comments@
254
255 h3. @Encoders::Filter@
256
257 * *NEW* option @tokens@.
258 * *CHANGED*: Now it simply delegates to the output.
259 * *REMOVED* @include_text_token?@ and @include_block_token?@ methods.
260
261 h3. @Encoders::HTML@
262
263 The HTML encoder was cleaned up and simplified.
264
265 * *NEW*: HTML5 and CSS 3 compatible.
266 See "#215":http://odd-eyed-code.org/issues/215.
267 * *ADDED* support for @:line_number_anchors@.
268 See "#208":http://odd-eyed-code.org/issues/208.
269 * *CHANGED* the default style to @:alpha@.
270 * *CHANGED*: Use double click to toggle line numbers in table mode (as single
271 click jumps to an anchor.)
272 * *REMOVED* support for @:line_numbers => :list@.
273 * *FIXED* splitting of lines for @:line_numbers => :inline@, so that the line
274 numbers don't get colored, too.
275 * *RENAMED* @Output#numerize@ to @#number@, which is an actual English word.
276
277 h3. @Encoders::LinesOfCode@
278
279 * *CHANGED*: @compile@ and @finish@ methods are now protected.
280
281 h3. *Renamed*: @Encoders::Terminal@ (was @Encoders::Term@)
282
283 * *RENAMED* from @Encoders::Term@, added @:term@ alias.
284 * *CLEANUP*: Use @#setup@'s @super@, don't use @:procedure@ token class.
285 * *CHANGED*: @#token@'s second parameter is no longer optional.
286 * *REMOVED* colors for obsolete token kinds.
287 * *FIXED* handling of line tokens.
288
289 h3. @Encoders::Text@
290
291 * *FIXED* default behavior of stripping the trailing newline.
292
293 h3. *RENAMED*: @Encoders::TokenKindFilter@ (was @Encoders::TokenClassFilter@)
294
295 * *NEW*: Handles token groups.
296 See "#223":http://odd-eyed-code.org/issues/223.
297 * *RENAMED* @include_block_token?@ to @include_group?@.
298
299 h3. @Encoders::Statistic@
300
301 * *CHANGED*: Tokens actions are counted separately.
302
303 h3. @Scanners::Scanner@
304
305 * *NEW* methods @#file_extension@ and @#encoding@.
306 * *NEW*: The @#tokenize@ method also takes an Array of Strings as source. The
307 code is highlighted as one and split into parts of the input lengths
308 after that using @Tokens#split_into_parts@.
309 * *NEW* method @#binary_string@
310 * *REMOVED* helper method @String#to_unix@.
311 * *REMOVED* method @#streamable?@.
312 * *REMOVED* @#marshal_load@ and @#marshal_dump@.
313 * *RENAMED* class method @normify@ to @normalize@; it also deals with encoding now.
314 * *CHANGED*: @#column@ starts counting with 1 instead of 0
315
316 h3. *NEW*: @Scanners::Clojure@
317
318 Thanks to Licenser, CodeRay now supports the Clojure language.
319
320 h3. @Scanners::CSS@
321
322 * *NEW*: Rudimentary support for the @attr@, @counter@, and @counters@ functions.
323 See "#224":http://odd-eyed-code.org/issues/224.
324 * *NEW*: Rudimentary support for CSS 3 colors.
325 * *CHANGED*: Attribute selectors are highlighted as @:attribute_name@ instead of @:string@.
326 * *CHANGED*: Comments are scanned as one token instead of three.
327
328 h3. @Scanners::Debug@
329
330 * *NEW*: Support for line tokens (@begin_line@ and @end_line@ represented by @[@ and @]@.)
331 * *FIXED*: Don't send @:error@ and @nil@ tokens for buggy input any more.
332 * *FIXED*: Closes unclosed tokens at the end of @scan_tokens@.
333 * *IMPROVED*: Highlight unknown tokens as @:error@.
334 * *CHANGED*: Raises an error when trying to end an invalid token group.
335
336 h3. @Scanners::Delphi@
337
338 * *FIXED*: Closes open string groups.
339
340 h3. @Scanners::Diff@
341
342 * *NEW*: Highlighting of code based on file names.
343 See ticket "#52":http://odd-eyed-code.org/issues/52.
344
345 Use the @:highlight_code@ option to turn this feature off. It's enabled
346 by default.
347
348 This is a very original feature. It enables multi-language highlighting for
349 diff files, which is especially helpful for CodeRay development itself. The
350 updated version of the scanner test suite generated .debug.diff.html files
351 using this.
352
353 Note: This is still experimental. Tokens spanning more than one line
354 may get highlighted incorrectly. CodeRay tries to keep scanner states
355 between the lines and changes, but the quality of the results depend on
356 the scanner.
357 * *NEW*: Inline change highlighting, as suggested by Eric Thomas.
358 See ticket "#227":http://odd-eyed-code.org/issues/227 for details.
359
360 Use the @:inline_diff@ option to turn this feature off. It's enabled by
361 default.
362
363 For single-line changes (that is, a single deleted line followed by a single
364 inserted line), this feature surrounds the changed parts with an
365 @:eyecatcher@ group which appears in a more saturated background color.
366 The implementation is quite complex, and highly experimental. The problem
367 with multi-layer tokenizing is that the tokens have to be split into parts.
368 If the inline change starts, say, in the middle of a string, then additional
369 @:end_group@ and @:begin_group@ tokens must be inserted to keep the group
370 nesting intact. The extended @Scanner#tokenize@ method and the new
371 @Tokens#split_into_parts@ method take care of this.
372 * *NEW*: Highlight the file name in the change headers as @:filename@.
373 * *CHANGED*: Highlight unknown lines as @:comment@ instead of @:head@.
374 * *IMPROVED*: Background colors for Diff output have been optimized.
375
376 h3. *RENAMED*: @Scanners::ERB@ (was @Scanners::RHTML@)
377
378 h3. *NEW*: @Scanners::HAML@
379
380 It uses the new :state options of the HTML and Ruby scanners.
381
382 Some rare cases are not considered (like @#{...}@ snippets inside of :javascript blocks),
383 but it highlights pretty well.
384
385 h3. @Scanners::HTML@
386
387 * *FIXED*: Closes open string groups.
388
389 h3. @Scanners::JavaScript@
390
391 * *IMPROVED*: Added @NaN@ and @Infinity@ to list of predefined constants.
392 * *IMPROVED* recognition of RegExp literals with leading spaces.
393
394 h3. @Scanners::Java@
395
396 * *NEW*: Package names are highlighted as @:namespace@.
397 See "#210":http://odd-eyed-code.org/issues/210.
398
399 h3. *REMOVED*: @Scanners::NitroXHTML@
400
401 Nitro is "dead":http://www.nitrohq.com/.
402
403 h3. *RENAMED*: @Scanners::Text@ (was @Scanners::Plaintext@)
404
405 * *IMPROVED*: Just returns the string without scanning (faster).
406
407 This is much faster than scanning until @/\z/@ in Ruby 1.8.
408
409 h3. @Scanners::Python@
410
411 * *CHANGED*: Docstrings are highlighted as @:comment@.
412 See "#190":http://odd-eyed-code.org/issues/190.
413
414 h3. *NEW*: @Scanners::Raydebug@
415
416 Copied from @Scanners::Debug@, highlights the token dump instead of importing it. It also reacts to the @.raydebug@ file
417 name suffix now.
418
419 h3. @Scanners::Ruby@
420
421 * *ADDED* more predefined keywords (see http://murfy.de/ruby-constants).
422 * *IMPROVED* support for singleton method definitions.
423 See "#147":http://odd-eyed-code.org/issues/147.
424 * *FIXED*: Don't highlight methods with a capital letter as constants
425 (eg. @GL.PushMatrix@).
426 * *NEW*: Highlight buggy floats (like .5) as @:error@.
427 * *CLEANUP* of documentation, names of constants and variables, state handling.
428
429 Moved @StringState@ class from @patterns.rb@ into a separate file.
430 * *NEW*: Complicated rule for recognition of @foo=@ style method names.
431 * *NEW*: Handles @:keep_state@ option (a bit; experimental).
432
433 Actually, Ruby checks if there is @[~>=]@, but not @=>@ following the name.
434
435 * *REMOVED* @EncodingError@
436
437 h3. *REMOVED* @Scanners::Scheme@
438
439 * It is too buggy, and nobody was using it. To be added again when it's fixed.
440 See "#59":http://odd-eyed-code.org/issues/59.
441
442 h3. @Scanners::SQL@
443
444 * *IMPROVED*: Extended list of keywords and functions (thanks to
445 Joshua Galvez, Etienne Massip, and others).
446
447 See "#221":http://odd-eyed-code.org/issues/221.
448 * *FIXED*: Closes open string groups.
449 * *FIXED*: Words after @.@ are always recognized as @:ident@.
450
451 h3. @Scanners::YAML@
452
453 * *FIXED*: Allow spaces before colon in mappings.
454
455 See "#231":http://odd-eyed-code.org/issues/231.
456
457 h3. *NEW*: @Styles::Alpha@
458
459 A style that uses transparent HSLA colors as defined in CSS 3. See "#199":http://odd-eyed-code.org/issues/199.
460
461 It also uses the CSS 3 property @user-select: none@ to keep the user from selecting the line numbers. This is especially
462 nice for @:inline@ line numbers. See "#226":http://odd-eyed-code.org/issues/226.
463
464 h3. @WordList@
465
466 Stripped down to 19 LOC.
467
468 * *RENAMED* @CaseIgnoringWordList@ to @WordList::CaseIgnoring@.
469 * *REMOVED* caching option because it creates memory leaks.
470 * *REMOVED* block option.
471
472 h3. @FileType@
473
474 * *NEW*: Recognizes @.gemspec@, @.rjs@, @.rpdf@ extensions, @Gemfile@, and @Capfile@ as Ruby.
475
476 Thanks to the authors of the TextMate Ruby bundle!
477 * *REMOVED* @FileType#shebang@ is a protected method now.
478
479 h3. @Plugin@
480
481 * *IMPROVED*: @register_for@ sets the @plugin_id@; it can now be a @Symbol@.
482 * *ADDED* @PluginHost#const_missing@ method: Plugins are loaded automatically.
483 Using @Scanners::JavaScript@ in your code loads @scanners/java_script.rb@.
484 * *ADDED* @#all_plugins@ method to simplify getting
485 information about all available plugins (suggested by bnhymn).
486 * *CHANGED* the default plugin key from @nil@ to @:default@.
487
488 h3. @GZip@
489
490 * *MOVED* into @CodeRay@ namespace.
491 * *MOVED* file from @gzip_simple.rb@ to @gzip.rb@.
492 * *REMOVED* @String@ extensions.
493
494 h3. More API changes
495
496 * *FIXED* @Encoders::HTML#token@'s second parameter is no longer optional.
497 * *CHANGED* @Encoders::HTML::Output@'s API.
498 * *REMOVED* lots of unused methods.
499
500 The helper classes were cleaned up; see above for details.
501
502 * *CHANGED* @Plugin@ API was simplified and stripped of all unnecessary features.
503 * *CHANGED* Moved @GZip@ and @FileType@ libraries into @CodeRay@; cleaned them up.