From 7d7df64611506d72bb125c6117389fd57f65deba Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Fri, 5 Apr 2013 17:34:22 +0600 Subject: [PATCH] [#19] restore codemirror highlight for comments code --- Gemfile | 4 +- Gemfile.lock | 5 -- app/assets/stylesheets/application.scss | 1 - .../stylesheets/design/pygments-github.scss | 63 ------------------- lib/redcarpet/render/gitlab_html.rb | 5 +- 5 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 app/assets/stylesheets/design/pygments-github.scss diff --git a/Gemfile b/Gemfile index c717eb7fb..d33d47350 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem 'diff-display', '~> 0.0.1' # Wiki gem "gollum", '~> 2.1.3' +gem "redcarpet", '~> 2.2.2' gem 'creole' gem 'rdiscount' # gem 'org-ruby' @@ -53,9 +54,6 @@ gem 'rest-client', '~> 1.6.6' gem 'attr_encrypted', '1.2.1' -gem "gitlab-pygments.rb", '~> 0.3.2', require: 'pygments.rb' -gem "redcarpet", "~> 2.2.2" - group :assets do gem 'sass-rails', '~> 3.2.5' gem 'coffee-rails', '~> 3.2.2' diff --git a/Gemfile.lock b/Gemfile.lock index 9d63ed2b0..2f620a232 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -129,9 +129,6 @@ GEM pygments.rb (>= 0.2.13) github-markdown (0.5.3) github-markup (0.7.5) - gitlab-pygments.rb (0.3.2) - posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) gollum (2.1.10) github-markdown github-markup (>= 0.7.0, < 1.0.0) @@ -374,7 +371,6 @@ GEM builder expression_parser will_paginate (3.0.4) - yajl-ruby (1.1.0) PLATFORMS ruby @@ -398,7 +394,6 @@ DEPENDENCIES factory_girl_rails (~> 4.0.0) gemoji (~> 1.2.1) github-linguist (~> 2.3.4) - gitlab-pygments.rb (~> 0.3.2) gollum (~> 2.1.3) grack! grit! diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 0c31ae72e..c908583cb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -4,4 +4,3 @@ @import "design/common"; @import "design/custom"; @import "design/build_lists_monitoring"; -@import "design/pygments-github"; \ No newline at end of file diff --git a/app/assets/stylesheets/design/pygments-github.scss b/app/assets/stylesheets/design/pygments-github.scss deleted file mode 100644 index 78488f3fc..000000000 --- a/app/assets/stylesheets/design/pygments-github.scss +++ /dev/null @@ -1,63 +0,0 @@ -/* https://github.com/richleland/pygments-css */ - -.hll { background-color: #ffffcc } -.c { color: #999988; font-style: italic } /* Comment */ -.err { color: #a61717; background-color: #e3d2d2 } /* Error */ -.k { color: #000000; font-weight: bold } /* Keyword */ -.o { color: #000000; font-weight: bold } /* Operator */ -.cm { color: #999988; font-style: italic } /* Comment.Multiline */ -.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ -.c1 { color: #999988; font-style: italic } /* Comment.Single */ -.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ -.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ -.ge { color: #000000; font-style: italic } /* Generic.Emph */ -.gr { color: #aa0000 } /* Generic.Error */ -.gh { color: #999999 } /* Generic.Heading */ -.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ -.go { color: #888888 } /* Generic.Output */ -.gp { color: #555555 } /* Generic.Prompt */ -.gs { font-weight: bold } /* Generic.Strong */ -.gu { color: #aaaaaa } /* Generic.Subheading */ -.gt { color: #aa0000 } /* Generic.Traceback */ -.kc { color: #000000; font-weight: bold } /* Keyword.Constant */ -.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ -.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ -.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ -.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ -.kt { color: #445588; font-weight: bold } /* Keyword.Type */ -.m { color: #009999 } /* Literal.Number */ -.s { color: #d01040 } /* Literal.String */ -.na { color: #008080 } /* Name.Attribute */ -.nb { color: #0086B3 } /* Name.Builtin */ -.nc { color: #445588; font-weight: bold } /* Name.Class */ -.no { color: #008080 } /* Name.Constant */ -.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ -.ni { color: #800080 } /* Name.Entity */ -.ne { color: #990000; font-weight: bold } /* Name.Exception */ -.nf { color: #990000; font-weight: bold } /* Name.Function */ -.nl { color: #990000; font-weight: bold } /* Name.Label */ -.nn { color: #555555 } /* Name.Namespace */ -.nt { color: #000080 } /* Name.Tag */ -.nv { color: #008080 } /* Name.Variable */ -.ow { color: #000000; font-weight: bold } /* Operator.Word */ -.w { color: #bbbbbb } /* Text.Whitespace */ -.mf { color: #009999 } /* Literal.Number.Float */ -.mh { color: #009999 } /* Literal.Number.Hex */ -.mi { color: #009999 } /* Literal.Number.Integer */ -.mo { color: #009999 } /* Literal.Number.Oct */ -.sb { color: #d01040 } /* Literal.String.Backtick */ -.sc { color: #d01040 } /* Literal.String.Char */ -.sd { color: #d01040 } /* Literal.String.Doc */ -.s2 { color: #d01040 } /* Literal.String.Double */ -.se { color: #d01040 } /* Literal.String.Escape */ -.sh { color: #d01040 } /* Literal.String.Heredoc */ -.si { color: #d01040 } /* Literal.String.Interpol */ -.sx { color: #d01040 } /* Literal.String.Other */ -.sr { color: #009926 } /* Literal.String.Regex */ -.s1 { color: #d01040 } /* Literal.String.Single */ -.ss { color: #990073 } /* Literal.String.Symbol */ -.bp { color: #999999 } /* Name.Builtin.Pseudo */ -.vc { color: #008080 } /* Name.Variable.Class */ -.vg { color: #008080 } /* Name.Variable.Global */ -.vi { color: #008080 } /* Name.Variable.Instance */ -.il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 732d2ae7a..8234e2675 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -12,9 +12,6 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML end def block_code(code, language) - options = { options: {encoding: 'utf-8'} } - options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language) - # New lines are placed to fix an rendering issue # with code wrapped inside

tag for next case: # @@ -24,7 +21,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML # <<-HTML -
#{Pygments.highlight(code, options)}
+
#{code}
HTML end