Commit Graph

30 Commits

Author SHA1 Message Date
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02:00
Mark Chao bc14e4ed10 Move :plain option to Highlight class
This is to DRY the repeated file size check.

Move spec and constants to Highlight
2018-10-30 15:44:55 +08:00
Mark Chao 39ae9a59a5 Make Highlight accept language param
This replaces the repository param.
This allows more flexiblity as sometimes we have highlight content
not related to repository. Sometimes we know ahead of time the language
of the content. Lastly language determination seems better fit as a
logic in the Blob class.
`repository` param is only used to determine the language, which seems
to be the responsiblity of Blob.
2018-10-30 15:44:55 +08:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00:00
Mark Chao 3bfc08be91 Fix syntax highlight taking too long
Use Timeout to switch to plain rendering
2018-09-03 11:02:43 +08:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Douwe Maan e6e29f9220 Use Diff::File blob methods from diff highlighter 2017-06-08 09:39:54 -05:00
Douwe Maan dbffaaa97e Blob#load_all_data! doesn’t need an argument 2017-06-07 14:28:33 -05:00
Douwe Maan b1012d986c Autolink package names in Gemfile 2017-05-10 08:26:21 -05:00
Douwe Maan 6890327762 Copy code as GFM from diffs, blobs and GFM code blocks 2017-03-14 15:29:00 -06:00
http://jneen.net/ c763c7e402 use the proper variable names o_O 2016-07-14 12:21:22 -07:00
http://jneen.net/ b468672d76 style: factor out `@lexer` into a method 2016-07-14 11:44:59 -07:00
http://jneen.net/ 822304b19f fix Gitlab::Highlight#initializer bugs from rebase 2016-07-14 11:40:55 -07:00
http://jneen.net/ f82287e2cc use the local lexer variable to respect plain: ... 2016-07-14 10:08:15 -07:00
http://jneen.net/ 6107933ba3 inline #rouge_formatter 2016-07-14 10:08:15 -07:00
http://jneen.net/ e1824aa101 use the new token_lines interface to format lines 2016-07-14 10:08:15 -07:00
http://jneen.net/ 3bb65815b0 kill the :cssclass option 2016-07-14 10:08:15 -07:00
http://jneen.net/ 7214a221e0 kill the nowrap option
the <pre><code> wrapping is *always* used by the helper, and *never* by
anywhere else, so pull the wrapping into the helper
2016-07-14 10:08:14 -07:00
http://jneen.net/ 7e8a92fbd1 the call site always specifies this option 2016-07-14 10:08:14 -07:00
http://jneen.net/ 681b5af586 do this thing in a clearer way 2016-07-14 10:08:14 -07:00
http://jneen.net/ 66b37149eb support cgi style options, such as erb?parent=json 2016-06-27 14:17:49 -07:00
http://jneen.net/ e08ff468e8 make #custom_language private 2016-06-27 14:17:49 -07:00
http://jneen.net/ c8b52761bc appease rubocop 2016-06-27 14:17:49 -07:00
http://jneen.net/ f8b80f7fae add custom highlighting via .gitattributes
paired with @stanhu
2016-06-27 14:17:49 -07:00
Zeger-Jan van de Weg ad99404d25 Properly handle bigger files 2016-04-28 21:28:39 +02:00
Jacob Vosmaer 51574d779c Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into lazy-blobs 2016-02-01 13:51:05 +01:00
Douwe Maan 5c7259c7c3 Don't crash when file can't be highlighted 2016-01-19 15:13:37 +01:00
Douwe Maan 512bebe21d Refactor Gitlab::Highlight and fix tests 2016-01-19 14:52:41 +01:00
Douwe Maan 8dfad143d4 Add inline diff markers in highlighted diffs. 2016-01-14 22:28:07 +01:00
Douwe Maan 3a1d053599 Remove duplication around highlighting. 2016-01-14 15:11:50 +01:00