Merge pull request #8425 from rumpelsepp/rouge

Replace highlight.js with rouge-fork rugments
This commit is contained in:
Dmitriy Zaporozhets 2015-01-15 14:28:24 -08:00
commit 892be53fa3
34 changed files with 505 additions and 747 deletions

View file

@ -46,7 +46,7 @@ gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
gem 'gitlab_omniauth-ldap', '1.2.0', require: "omniauth-ldap" gem 'gitlab_omniauth-ldap', '1.2.0', require: "omniauth-ldap"
# Git Wiki # Git Wiki
gem 'gollum-lib', '~> 3.0.0' gem 'gollum-lib', '~> 4.0.0'
# Language detection # Language detection
gem "gitlab-linguist", "~> 3.0.0", require: "linguist" gem "gitlab-linguist", "~> 3.0.0", require: "linguist"
@ -265,3 +265,4 @@ end
gem "newrelic_rpm" gem "newrelic_rpm"
gem 'octokit', '3.7.0' gem 'octokit', '3.7.0'
gem "rugments"

View file

@ -166,13 +166,14 @@ GEM
rugged (~> 0.19) rugged (~> 0.19)
gherkin-ruby (0.3.1) gherkin-ruby (0.3.1)
racc racc
github-markup (1.1.0) github-markup (1.3.1)
posix-spawn (~> 0.3.8)
gitlab-flowdock-git-hook (0.4.2.2) gitlab-flowdock-git-hook (0.4.2.2)
gitlab-grit (>= 2.4.1) gitlab-grit (>= 2.4.1)
multi_json multi_json
gitlab-grack (2.0.0.pre) gitlab-grack (2.0.0.pre)
rack (~> 1.5.1) rack (~> 1.5.1)
gitlab-grit (2.6.12) gitlab-grit (2.7.2)
charlock_holmes (~> 0.6) charlock_holmes (~> 0.6)
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (~> 1.15) mime-types (~> 1.15)
@ -194,11 +195,13 @@ GEM
omniauth (~> 1.0) omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.1) pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.3) rubyntlm (~> 0.3)
gollum-lib (3.0.0) gollum-grit_adapter (0.1.0)
github-markup (~> 1.1.0) gitlab-grit (~> 2.7.1)
gitlab-grit (~> 2.6.5) gollum-lib (4.0.0)
nokogiri (~> 1.6.1) github-markup (~> 1.3.1)
rouge (~> 1.3.3) gollum-grit_adapter (~> 0.1.0)
nokogiri (~> 1.6.4)
rouge (~> 1.7.4)
sanitize (~> 2.1.0) sanitize (~> 2.1.0)
stringex (~> 2.5.1) stringex (~> 2.5.1)
gon (5.0.1) gon (5.0.1)
@ -296,7 +299,7 @@ GEM
treetop (~> 1.4.8) treetop (~> 1.4.8)
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.6.0) mini_portile (0.6.1)
minitest (5.3.5) minitest (5.3.5)
mousetrap-rails (1.4.6) mousetrap-rails (1.4.6)
multi_json (1.10.1) multi_json (1.10.1)
@ -308,8 +311,8 @@ GEM
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (2.8.0) net-ssh (2.8.0)
newrelic_rpm (3.9.4.245) newrelic_rpm (3.9.4.245)
nokogiri (1.6.2.1) nokogiri (1.6.5)
mini_portile (= 0.6.0) mini_portile (~> 0.6.0)
nprogress-rails (0.1.2.3) nprogress-rails (0.1.2.3)
oauth (0.4.7) oauth (0.4.7)
oauth2 (0.8.1) oauth2 (0.8.1)
@ -445,7 +448,7 @@ GEM
rest-client (1.6.7) rest-client (1.6.7)
mime-types (>= 1.16) mime-types (>= 1.16)
rinku (1.7.3) rinku (1.7.3)
rouge (1.3.3) rouge (1.7.4)
rspec (2.14.1) rspec (2.14.1)
rspec-core (~> 2.14.0) rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0) rspec-expectations (~> 2.14.0)
@ -465,6 +468,7 @@ GEM
rubyntlm (0.4.0) rubyntlm (0.4.0)
rubypants (0.2.0) rubypants (0.2.0)
rugged (0.21.2) rugged (0.21.2)
rugments (1.0.0.beta3)
safe_yaml (0.9.7) safe_yaml (0.9.7)
sanitize (2.1.0) sanitize (2.1.0)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
@ -536,7 +540,7 @@ GEM
sprockets (~> 2.8) sprockets (~> 2.8)
stamp (0.5.0) stamp (0.5.0)
state_machine (1.2.0) state_machine (1.2.0)
stringex (2.5.1) stringex (2.5.2)
temple (0.6.7) temple (0.6.7)
term-ansicolor (1.2.2) term-ansicolor (1.2.2)
tins (~> 0.8) tins (~> 0.8)
@ -651,7 +655,7 @@ DEPENDENCIES
gitlab_git (= 7.0.0.rc14) gitlab_git (= 7.0.0.rc14)
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.0) gitlab_omniauth-ldap (= 1.2.0)
gollum-lib (~> 3.0.0) gollum-lib (~> 4.0.0)
gon (~> 5.0.0) gon (~> 5.0.0)
grape (~> 0.6.1) grape (~> 0.6.1)
grape-entity (~> 0.4.2) grape-entity (~> 0.4.2)
@ -703,6 +707,7 @@ DEPENDENCIES
redis-rails redis-rails
request_store request_store
rspec-rails rspec-rails
rugments
sanitize (~> 2.0) sanitize (~> 2.0)
sass-rails (~> 4.0.2) sass-rails (~> 4.0.2)
sdoc sdoc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -24,7 +24,6 @@
#= require g.bar-min #= require g.bar-min
#= require chart-lib.min #= require chart-lib.min
#= require branch-graph #= require branch-graph
#= require highlight.pack
#= require ace/ace #= require ace/ace
#= require ace/ext-searchbox #= require ace/ext-searchbox
#= require d3 #= require d3

View file

@ -4,7 +4,6 @@ $ ->
class Dispatcher class Dispatcher
constructor: () -> constructor: () ->
@initSearch() @initSearch()
@initHighlight()
@initPageScripts() @initPageScripts()
initPageScripts: -> initPageScripts: ->
@ -130,10 +129,3 @@ class Dispatcher
project_ref = opts.data('autocomplete-project-ref') project_ref = opts.data('autocomplete-project-ref')
new SearchAutocomplete(path, project_id, project_ref) new SearchAutocomplete(path, project_id, project_ref)
initHighlight: ->
$('.highlight pre code').each (i, e) ->
$(e).html($.map($(e).html().split("\n"), (line, i) ->
"<span class='line' id='LC" + (i + 1) + "'>" + line + "</span>"
).join("\n"))
hljs.highlightBlock(e)

View file

@ -114,10 +114,6 @@ class @Notes
if @isNewNote(note) if @isNewNote(note)
@note_ids.push(note.id) @note_ids.push(note.id)
$('ul.main-notes-list').append(note.html) $('ul.main-notes-list').append(note.html)
code = "#note_" + note.id + " .highlight pre code"
$(code).each (i, e) ->
hljs.highlightBlock(e)
### ###
Check if note does not exists on page Check if note does not exists on page
@ -265,9 +261,6 @@ class @Notes
note_li.replaceWith(note.html) note_li.replaceWith(note.html)
note_li.find('.note-edit-form').hide() note_li.find('.note-edit-form').hide()
note_li.find('.note-text').show() note_li.find('.note-text').show()
code = "#note_" + note.id + " .highlight pre code"
$(code).each (i, e) ->
hljs.highlightBlock(e)
### ###
Called in response to clicking the edit note link Called in response to clicking the edit note link

View file

@ -6,7 +6,6 @@
*= require jquery.ui.autocomplete *= require jquery.ui.autocomplete
*= require jquery.atwho *= require jquery.atwho
*= require select2 *= require select2
*= require highlightjs.min
*= require_self *= require_self
*= require dropzone/basic *= require dropzone/basic
*/ */

View file

@ -1,4 +1,4 @@
.highlighted-data { .file-content.code {
border: none; border: none;
box-shadow: none; box-shadow: none;
margin: 0px; margin: 0px;
@ -13,8 +13,13 @@
font-size: 12px !important; font-size: 12px !important;
line-height: 16px !important; line-height: 16px !important;
margin: 0; margin: 0;
overflow: auto;
overflow-y: hidden;
white-space: pre;
word-wrap: normal;
code { code {
font-family: $monospace_font;
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
padding: 0; padding: 0;
@ -25,10 +30,6 @@
} }
} }
.hljs {
padding: 0;
}
.line-numbers { .line-numbers {
padding: 10px; padding: 10px;
text-align: right; text-align: right;
@ -51,18 +52,18 @@
} }
} }
} }
}
.highlight { .note-text .code {
overflow: auto; border: none;
overflow-y: hidden; box-shadow: none;
background: $box_bg;
pre { padding: 1em;
white-space: pre;
word-wrap: normal;
code { code {
font-family: $monospace_font; font-family: $monospace_font;
} white-space: pre;
} word-wrap: normal;
padding: 0;
} }
} }

View file

@ -1,199 +1,83 @@
.dark { /* https://github.com/MozMorris/tomorrow-pygments */
background-color: #232323; .code.dark {
.line.hll {
background: #558;
}
.highlight{
border-left: 1px solid #444;
}
.no-highlight {
color: #DDD;
}
pre.code,
.line-numbers,
.line-numbers a { .line-numbers a {
color: #666; background-color: #1d1f21 !important;
color: #c5c8c6 !important;
} }
pre { pre.code {
background-color: #232323; border-left: 1px solid #666;
} }
.hljs { pre.hll {
display: block; background-color: #fff !important;
background: #232323;
color: #E6E1DC;
} }
.hljs-comment, .hll { background-color: #373b41 }
.hljs-template_comment, .c { color: #969896 } /* Comment */
.hljs-javadoc, .err { color: #cc6666 } /* Error */
.hljs-shebang { .k { color: #b294bb } /* Keyword */
color: #BC9458; .l { color: #de935f } /* Literal */
font-style: italic; .n { color: #c5c8c6 } /* Name */
} .o { color: #8abeb7 } /* Operator */
.p { color: #c5c8c6 } /* Punctuation */
.hljs-keyword, .cm { color: #969896 } /* Comment.Multiline */
.ruby .hljs-function .hljs-keyword, .cp { color: #969896 } /* Comment.Preproc */
.hljs-request, .c1 { color: #969896 } /* Comment.Single */
.hljs-status, .cs { color: #969896 } /* Comment.Special */
.nginx .hljs-title, .gd { color: #cc6666 } /* Generic.Deleted */
.method, .ge { font-style: italic } /* Generic.Emph */
.hljs-list .hljs-title { .gh { color: #c5c8c6; font-weight: bold } /* Generic.Heading */
color: #C26230; .gi { color: #b5bd68 } /* Generic.Inserted */
} .gp { color: #969896; font-weight: bold } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.hljs-string, .gu { color: #8abeb7; font-weight: bold } /* Generic.Subheading */
.hljs-number, .kc { color: #b294bb } /* Keyword.Constant */
.hljs-regexp, .kd { color: #b294bb } /* Keyword.Declaration */
.hljs-tag .hljs-value, .kn { color: #8abeb7 } /* Keyword.Namespace */
.hljs-cdata, .kp { color: #b294bb } /* Keyword.Pseudo */
.hljs-filter .hljs-argument, .kr { color: #b294bb } /* Keyword.Reserved */
.hljs-attr_selector, .kt { color: #f0c674 } /* Keyword.Type */
.apache .hljs-cbracket, .ld { color: #b5bd68 } /* Literal.Date */
.hljs-date, .m { color: #de935f } /* Literal.Number */
.tex .hljs-command, .s { color: #b5bd68 } /* Literal.String */
.markdown .hljs-link_label { .na { color: #81a2be } /* Name.Attribute */
color: #A5C261; .nb { color: #c5c8c6 } /* Name.Builtin */
} .nc { color: #f0c674 } /* Name.Class */
.no { color: #cc6666 } /* Name.Constant */
.hljs-subst { .nd { color: #8abeb7 } /* Name.Decorator */
color: #519F50; .ni { color: #c5c8c6 } /* Name.Entity */
} .ne { color: #cc6666 } /* Name.Exception */
.nf { color: #81a2be } /* Name.Function */
.hljs-tag, .nl { color: #c5c8c6 } /* Name.Label */
.hljs-tag .hljs-keyword, .nn { color: #f0c674 } /* Name.Namespace */
.hljs-tag .hljs-title, .nx { color: #81a2be } /* Name.Other */
.hljs-doctype, .py { color: #c5c8c6 } /* Name.Property */
.hljs-sub .hljs-identifier, .nt { color: #8abeb7 } /* Name.Tag */
.hljs-pi, .nv { color: #cc6666 } /* Name.Variable */
.input_number { .ow { color: #8abeb7 } /* Operator.Word */
color: #E8BF6A; .w { color: #c5c8c6 } /* Text.Whitespace */
} .mf { color: #de935f } /* Literal.Number.Float */
.mh { color: #de935f } /* Literal.Number.Hex */
.hljs-identifier { .mi { color: #de935f } /* Literal.Number.Integer */
color: #D0D0FF; .mo { color: #de935f } /* Literal.Number.Oct */
} .sb { color: #b5bd68 } /* Literal.String.Backtick */
.sc { color: #c5c8c6 } /* Literal.String.Char */
.hljs-class .hljs-title, .sd { color: #969896 } /* Literal.String.Doc */
.haskell .hljs-type, .s2 { color: #b5bd68 } /* Literal.String.Double */
.smalltalk .hljs-class, .se { color: #de935f } /* Literal.String.Escape */
.hljs-javadoctag, .sh { color: #b5bd68 } /* Literal.String.Heredoc */
.hljs-yardoctag, .si { color: #de935f } /* Literal.String.Interpol */
.hljs-phpdoc { .sx { color: #b5bd68 } /* Literal.String.Other */
text-decoration: none; .sr { color: #b5bd68 } /* Literal.String.Regex */
} .s1 { color: #b5bd68 } /* Literal.String.Single */
.ss { color: #b5bd68 } /* Literal.String.Symbol */
.hljs-constant { .bp { color: #c5c8c6 } /* Name.Builtin.Pseudo */
color: #DA4939; .vc { color: #cc6666 } /* Name.Variable.Class */
} .vg { color: #cc6666 } /* Name.Variable.Global */
.vi { color: #cc6666 } /* Name.Variable.Instance */
.il { color: #de935f } /* Literal.Number.Integer.Long */
.hljs-symbol,
.hljs-built_in,
.ruby .hljs-symbol .hljs-string,
.ruby .hljs-symbol .hljs-identifier,
.markdown .hljs-link_url,
.hljs-attribute {
color: #6D9CBE;
}
.markdown .hljs-link_url {
text-decoration: underline;
}
.hljs-params,
.hljs-variable,
.clojure .hljs-attribute {
color: #D0D0FF;
}
.css .hljs-tag,
.hljs-rules .hljs-property,
.hljs-pseudo,
.tex .hljs-special {
color: #CDA869;
}
.css .hljs-class {
color: #9B703F;
}
.hljs-rules .hljs-keyword {
color: #C5AF75;
}
.hljs-rules .hljs-value {
color: #CF6A4C;
}
.css .hljs-id {
color: #8B98AB;
}
.hljs-annotation,
.apache .hljs-sqbracket,
.nginx .hljs-built_in {
color: #9B859D;
}
.hljs-preprocessor,
.hljs-preprocessor *,
.hljs-pragma {
color: #8996A8 !important;
}
.hljs-hexcolor,
.css .hljs-value .hljs-number {
color: #A5C261;
}
.hljs-title,
.hljs-decorator,
.css .hljs-function {
color: #FFC66D;
}
.diff .hljs-header,
.hljs-chunk {
background-color: #2F33AB;
color: #E6E1DC;
display: inline-block;
width: 100%;
}
.diff .hljs-change {
background-color: #4A410D;
color: #F8F8F8;
display: inline-block;
width: 100%;
}
.hljs-addition {
background-color: #144212;
color: #E6E1DC;
display: inline-block;
width: 100%;
}
.hljs-deletion {
background-color: #600;
color: #E6E1DC;
display: inline-block;
width: 100%;
}
.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.7;
}
} }

View file

@ -1,159 +1,79 @@
.monokai { /* https://github.com/richleland/pygments-css/blob/master/monokai.css */
background-color: #272822; .code.monokai {
.highlight{
border-left: 1px solid #444;
}
.line.hll {
background: #558;
}
.no-highlight {
color: #DDD;
}
pre.highlight,
.line-numbers,
.line-numbers a { .line-numbers a {
color: #666; background:#272822 !important;
color:#f8f8f2 !important;
} }
pre { pre.code {
background-color: #272822; border-left: 1px solid #555;
color: #f8f8f2;
} }
.hljs { .hll { background-color: #49483e }
display: block; .c { color: #75715e } /* Comment */
background: #272822; .err { color: #960050; background-color: #1e0010 } /* Error */
} .k { color: #66d9ef } /* Keyword */
.l { color: #ae81ff } /* Literal */
.n { color: #f8f8f2 } /* Name */
.o { color: #f92672 } /* Operator */
.p { color: #f8f8f2 } /* Punctuation */
.cm { color: #75715e } /* Comment.Multiline */
.cp { color: #75715e } /* Comment.Preproc */
.c1 { color: #75715e } /* Comment.Single */
.cs { color: #75715e } /* Comment.Special */
.ge { font-style: italic } /* Generic.Emph */
.gs { font-weight: bold } /* Generic.Strong */
.kc { color: #66d9ef } /* Keyword.Constant */
.kd { color: #66d9ef } /* Keyword.Declaration */
.kn { color: #f92672 } /* Keyword.Namespace */
.kp { color: #66d9ef } /* Keyword.Pseudo */
.kr { color: #66d9ef } /* Keyword.Reserved */
.kt { color: #66d9ef } /* Keyword.Type */
.ld { color: #e6db74 } /* Literal.Date */
.m { color: #ae81ff } /* Literal.Number */
.s { color: #e6db74 } /* Literal.String */
.na { color: #a6e22e } /* Name.Attribute */
.nb { color: #f8f8f2 } /* Name.Builtin */
.nc { color: #a6e22e } /* Name.Class */
.no { color: #66d9ef } /* Name.Constant */
.nd { color: #a6e22e } /* Name.Decorator */
.ni { color: #f8f8f2 } /* Name.Entity */
.ne { color: #a6e22e } /* Name.Exception */
.nf { color: #a6e22e } /* Name.Function */
.nl { color: #f8f8f2 } /* Name.Label */
.nn { color: #f8f8f2 } /* Name.Namespace */
.nx { color: #a6e22e } /* Name.Other */
.py { color: #f8f8f2 } /* Name.Property */
.nt { color: #f92672 } /* Name.Tag */
.nv { color: #f8f8f2 } /* Name.Variable */
.ow { color: #f92672 } /* Operator.Word */
.w { color: #f8f8f2 } /* Text.Whitespace */
.mf { color: #ae81ff } /* Literal.Number.Float */
.mh { color: #ae81ff } /* Literal.Number.Hex */
.mi { color: #ae81ff } /* Literal.Number.Integer */
.mo { color: #ae81ff } /* Literal.Number.Oct */
.sb { color: #e6db74 } /* Literal.String.Backtick */
.sc { color: #e6db74 } /* Literal.String.Char */
.sd { color: #e6db74 } /* Literal.String.Doc */
.s2 { color: #e6db74 } /* Literal.String.Double */
.se { color: #ae81ff } /* Literal.String.Escape */
.sh { color: #e6db74 } /* Literal.String.Heredoc */
.si { color: #e6db74 } /* Literal.String.Interpol */
.sx { color: #e6db74 } /* Literal.String.Other */
.sr { color: #e6db74 } /* Literal.String.Regex */
.s1 { color: #e6db74 } /* Literal.String.Single */
.ss { color: #e6db74 } /* Literal.String.Symbol */
.bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.vc { color: #f8f8f2 } /* Name.Variable.Class */
.vg { color: #f8f8f2 } /* Name.Variable.Global */
.vi { color: #f8f8f2 } /* Name.Variable.Instance */
.il { color: #ae81ff } /* Literal.Number.Integer.Long */
.hljs-tag, .gh { } /* Generic Heading & Diff Header */
.hljs-tag .hljs-title, .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */
.hljs-strong, .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */
.hljs-change, .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */
.hljs-winutils,
.hljs-flow,
.lisp .hljs-title,
.clojure .hljs-built_in,
.hljs-keyword,
.nginx .hljs-title,
.tex .hljs-special {
color: #F92672;
}
.hljs {
color: #F8F8F2;
}
.asciidoc .hljs-code,
.markdown .hljs-code,
.hljs-literal,
.hljs-function .hljs-keyword {
color: #66D9EF;
}
.hljs-code,
.hljs-class .hljs-title,
.hljs-header {
color: white;
}
.hljs-link_label,
.hljs-attribute,
.hljs-symbol,
.hljs-symbol .hljs-string,
.hljs-value,
.hljs-constant,
.hljs-number,
.hljs-regexp {
color: #AE81FF;
}
.hljs-string {
color: #E6DB74;
}
.hljs-params {
color: #fd971f;
}
.hljs-link_url,
.hljs-tag .hljs-value,
.hljs-bullet,
.hljs-subst,
.hljs-title,
.hljs-emphasis,
.hljs-type,
.hljs-preprocessor,
.hljs-pragma,
.ruby .hljs-class .hljs-parent,
.hljs-built_in,
.sql .hljs-aggregate,
.django .hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.hljs-javadoc,
.django .hljs-filter .hljs-argument,
.smalltalk .hljs-localvars,
.smalltalk .hljs-array,
.hljs-attr_selector,
.hljs-pseudo,
.hljs-addition,
.hljs-stream,
.hljs-envvar,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.hljs-prompt {
color: #A6E22E;
}
.hljs-comment,
.hljs-annotation,
.smartquote,
.hljs-blockquote,
.hljs-horizontal_rule,
.hljs-template_comment,
.hljs-decorator,
.hljs-pi,
.hljs-doctype,
.hljs-deletion,
.hljs-shebang,
.apache .hljs-sqbracket,
.tex .hljs-formula {
color: #75715E;
}
.hljs-keyword,
.hljs-literal,
.css .hljs-id,
.hljs-phpdoc,
.hljs-title,
.hljs-header,
.haskell .hljs-type,
.vbscript .hljs-built_in,
.sql .hljs-aggregate,
.rsl .hljs-built_in,
.smalltalk .hljs-class,
.diff .hljs-header,
.hljs-chunk,
.hljs-winutils,
.bash .hljs-variable,
.apache .hljs-tag,
.tex .hljs-special,
.hljs-request,
.hljs-status {
font-weight: bold;
}
.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.5;
}
} }

View file

@ -1,125 +1,101 @@
.solarized-dark { /* https://gist.github.com/qguv/7936275 */
background-color: #002B36; .code.solarized-dark {
.highlight{ pre.code,
.line-numbers,
.line-numbers a {
background-color: #002b36 !important;
color: #93a1a1 !important;
}
pre.code {
border-left: 1px solid #113b46; border-left: 1px solid #113b46;
} }
.line.hll { /* Solarized Dark
background: #000;
}
.no-highlight { For use with Jekyll and Pygments
color: #DDD;
}
pre { http://ethanschoonover.com/solarized
background-color: #002B36;
color: #eee;
}
.line-numbers a { SOLARIZED HEX ROLE
color: #666; --------- -------- ------------------------------------------
} base03 #002b36 background
base01 #586e75 comments / secondary content
base1 #93a1a1 body text / default code / primary content
orange #cb4b16 constants
red #dc322f regex, special keywords
blue #268bd2 reserved keywords
cyan #2aa198 strings, numbers
green #859900 operators, other keywords
*/
.hljs { .c { color: #586e75 } /* Comment */
display: block; .err { color: #93a1a1 } /* Error */
background: #002b36; .g { color: #93a1a1 } /* Generic */
color: #839496; .k { color: #859900 } /* Keyword */
} .l { color: #93a1a1 } /* Literal */
.n { color: #93a1a1 } /* Name */
.hljs-comment, .o { color: #859900 } /* Operator */
.hljs-template_comment, .x { color: #cb4b16 } /* Other */
.diff .hljs-header, .p { color: #93a1a1 } /* Punctuation */
.hljs-doctype, .cm { color: #586e75 } /* Comment.Multiline */
.hljs-pi, .cp { color: #859900 } /* Comment.Preproc */
.lisp .hljs-string, .c1 { color: #586e75 } /* Comment.Single */
.hljs-javadoc { .cs { color: #859900 } /* Comment.Special */
color: #586e75; .gd { color: #2aa198 } /* Generic.Deleted */
} .ge { color: #93a1a1; font-style: italic } /* Generic.Emph */
.gr { color: #dc322f } /* Generic.Error */
/* Solarized Green */ .gh { color: #cb4b16 } /* Generic.Heading */
.hljs-keyword, .gi { color: #859900 } /* Generic.Inserted */
.hljs-winutils, .go { color: #93a1a1 } /* Generic.Output */
.method, .gp { color: #93a1a1 } /* Generic.Prompt */
.hljs-addition, .gs { color: #93a1a1; font-weight: bold } /* Generic.Strong */
.css .hljs-tag, .gu { color: #cb4b16 } /* Generic.Subheading */
.hljs-request, .gt { color: #93a1a1 } /* Generic.Traceback */
.hljs-status, .kc { color: #cb4b16 } /* Keyword.Constant */
.nginx .hljs-title { .kd { color: #268bd2 } /* Keyword.Declaration */
color: #859900; .kn { color: #859900 } /* Keyword.Namespace */
} .kp { color: #859900 } /* Keyword.Pseudo */
.kr { color: #268bd2 } /* Keyword.Reserved */
/* Solarized Cyan */ .kt { color: #dc322f } /* Keyword.Type */
.hljs-number, .ld { color: #93a1a1 } /* Literal.Date */
.hljs-command, .m { color: #2aa198 } /* Literal.Number */
.hljs-string, .s { color: #2aa198 } /* Literal.String */
.hljs-tag .hljs-value, .na { color: #93a1a1 } /* Name.Attribute */
.hljs-rules .hljs-value, .nb { color: #B58900 } /* Name.Builtin */
.hljs-phpdoc, .nc { color: #268bd2 } /* Name.Class */
.tex .hljs-formula, .no { color: #cb4b16 } /* Name.Constant */
.hljs-regexp, .nd { color: #268bd2 } /* Name.Decorator */
.hljs-hexcolor, .ni { color: #cb4b16 } /* Name.Entity */
.hljs-link_url { .ne { color: #cb4b16 } /* Name.Exception */
color: #2aa198; .nf { color: #268bd2 } /* Name.Function */
} .nl { color: #93a1a1 } /* Name.Label */
.nn { color: #93a1a1 } /* Name.Namespace */
/* Solarized Blue */ .nx { color: #93a1a1 } /* Name.Other */
.hljs-title, .py { color: #93a1a1 } /* Name.Property */
.hljs-localvars, .nt { color: #268bd2 } /* Name.Tag */
.hljs-chunk, .nv { color: #268bd2 } /* Name.Variable */
.hljs-decorator, .ow { color: #859900 } /* Operator.Word */
.hljs-built_in, .w { color: #93a1a1 } /* Text.Whitespace */
.hljs-identifier, .mf { color: #2aa198 } /* Literal.Number.Float */
.vhdl .hljs-literal, .mh { color: #2aa198 } /* Literal.Number.Hex */
.hljs-id, .mi { color: #2aa198 } /* Literal.Number.Integer */
.css .hljs-function { .mo { color: #2aa198 } /* Literal.Number.Oct */
color: #268bd2; .sb { color: #586e75 } /* Literal.String.Backtick */
} .sc { color: #2aa198 } /* Literal.String.Char */
.sd { color: #93a1a1 } /* Literal.String.Doc */
/* Solarized Yellow */ .s2 { color: #2aa198 } /* Literal.String.Double */
.hljs-attribute, .se { color: #cb4b16 } /* Literal.String.Escape */
.hljs-variable, .sh { color: #93a1a1 } /* Literal.String.Heredoc */
.lisp .hljs-body, .si { color: #2aa198 } /* Literal.String.Interpol */
.smalltalk .hljs-number, .sx { color: #2aa198 } /* Literal.String.Other */
.hljs-constant, .sr { color: #dc322f } /* Literal.String.Regex */
.hljs-class .hljs-title, .s1 { color: #2aa198 } /* Literal.String.Single */
.hljs-parent, .ss { color: #2aa198 } /* Literal.String.Symbol */
.haskell .hljs-type, .bp { color: #268bd2 } /* Name.Builtin.Pseudo */
.hljs-link_reference { .vc { color: #268bd2 } /* Name.Variable.Class */
color: #b58900; .vg { color: #268bd2 } /* Name.Variable.Global */
} .vi { color: #268bd2 } /* Name.Variable.Instance */
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
/* Solarized Orange */
.hljs-preprocessor,
.hljs-preprocessor .hljs-keyword,
.hljs-pragma,
.hljs-shebang,
.hljs-symbol,
.hljs-symbol .hljs-string,
.diff .hljs-change,
.hljs-special,
.hljs-attr_selector,
.hljs-subst,
.hljs-cdata,
.clojure .hljs-title,
.css .hljs-pseudo,
.hljs-header {
color: #cb4b16;
}
/* Solarized Red */
.hljs-deletion,
.hljs-important {
color: #dc322f;
}
/* Solarized Violet */
.hljs-link_label {
color: #6c71c4;
}
.tex .hljs-formula {
background: #073642;
}
} }

View file

@ -0,0 +1,101 @@
/* https://gist.github.com/qguv/7936275 */
.code.solarized-light {
pre.code,
.line-numbers,
.line-numbers a {
background-color: #fdf6e3 !important;
color: #586e75 !important;
}
pre.code {
border-left: 1px solid #c5d0d4;
}
/* Solarized Light
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base01 #586e75 body text / default code / primary content
base1 #93a1a1 comments / secondary content
base3 #fdf6e3 background
orange #cb4b16 constants
red #dc322f regex, special keywords
blue #268bd2 reserved keywords
cyan #2aa198 strings, numbers
green #859900 operators, other keywords
*/
.c { color: #93a1a1 } /* Comment */
.err { color: #586e75 } /* Error */
.g { color: #586e75 } /* Generic */
.k { color: #859900 } /* Keyword */
.l { color: #586e75 } /* Literal */
.n { color: #586e75 } /* Name */
.o { color: #859900 } /* Operator */
.x { color: #cb4b16 } /* Other */
.p { color: #586e75 } /* Punctuation */
.cm { color: #93a1a1 } /* Comment.Multiline */
.cp { color: #859900 } /* Comment.Preproc */
.c1 { color: #93a1a1 } /* Comment.Single */
.cs { color: #859900 } /* Comment.Special */
.gd { color: #2aa198 } /* Generic.Deleted */
.ge { color: #586e75; font-style: italic } /* Generic.Emph */
.gr { color: #dc322f } /* Generic.Error */
.gh { color: #cb4b16 } /* Generic.Heading */
.gi { color: #859900 } /* Generic.Inserted */
.go { color: #586e75 } /* Generic.Output */
.gp { color: #586e75 } /* Generic.Prompt */
.gs { color: #586e75; font-weight: bold } /* Generic.Strong */
.gu { color: #cb4b16 } /* Generic.Subheading */
.gt { color: #586e75 } /* Generic.Traceback */
.kc { color: #cb4b16 } /* Keyword.Constant */
.kd { color: #268bd2 } /* Keyword.Declaration */
.kn { color: #859900 } /* Keyword.Namespace */
.kp { color: #859900 } /* Keyword.Pseudo */
.kr { color: #268bd2 } /* Keyword.Reserved */
.kt { color: #dc322f } /* Keyword.Type */
.ld { color: #586e75 } /* Literal.Date */
.m { color: #2aa198 } /* Literal.Number */
.s { color: #2aa198 } /* Literal.String */
.na { color: #586e75 } /* Name.Attribute */
.nb { color: #B58900 } /* Name.Builtin */
.nc { color: #268bd2 } /* Name.Class */
.no { color: #cb4b16 } /* Name.Constant */
.nd { color: #268bd2 } /* Name.Decorator */
.ni { color: #cb4b16 } /* Name.Entity */
.ne { color: #cb4b16 } /* Name.Exception */
.nf { color: #268bd2 } /* Name.Function */
.nl { color: #586e75 } /* Name.Label */
.nn { color: #586e75 } /* Name.Namespace */
.nx { color: #586e75 } /* Name.Other */
.py { color: #586e75 } /* Name.Property */
.nt { color: #268bd2 } /* Name.Tag */
.nv { color: #268bd2 } /* Name.Variable */
.ow { color: #859900 } /* Operator.Word */
.w { color: #586e75 } /* Text.Whitespace */
.mf { color: #2aa198 } /* Literal.Number.Float */
.mh { color: #2aa198 } /* Literal.Number.Hex */
.mi { color: #2aa198 } /* Literal.Number.Integer */
.mo { color: #2aa198 } /* Literal.Number.Oct */
.sb { color: #93a1a1 } /* Literal.String.Backtick */
.sc { color: #2aa198 } /* Literal.String.Char */
.sd { color: #586e75 } /* Literal.String.Doc */
.s2 { color: #2aa198 } /* Literal.String.Double */
.se { color: #cb4b16 } /* Literal.String.Escape */
.sh { color: #586e75 } /* Literal.String.Heredoc */
.si { color: #2aa198 } /* Literal.String.Interpol */
.sx { color: #2aa198 } /* Literal.String.Other */
.sr { color: #dc322f } /* Literal.String.Regex */
.s1 { color: #2aa198 } /* Literal.String.Single */
.ss { color: #2aa198 } /* Literal.String.Symbol */
.bp { color: #268bd2 } /* Name.Builtin.Pseudo */
.vc { color: #268bd2 } /* Name.Variable.Class */
.vg { color: #268bd2 } /* Name.Variable.Global */
.vi { color: #268bd2 } /* Name.Variable.Instance */
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
}

View file

@ -1,196 +1,78 @@
.white { /* https://github.com/aahan/pygments-github-style */
.line.hll { .code.white {
background: #FFA;
}
pre {
background-color: #fff;
color: #333;
}
.hljs {
background: #FFF;
}
pre.highlight,
.line-numbers,
.line-numbers a { .line-numbers a {
color: #999; background-color: #fff !important;
color: #333 !important;
} }
.hljs { pre.code {
display: block; border-left: 1px solid #bbb;
background: #fff; color: black;
} }
.hljs-comment, .hll { background-color: #f8f8f8 }
.hljs-template_comment, .c { color: #999988; font-style: italic; }
.hljs-javadoc, .err { color: #a61717; background-color: #e3d2d2; }
.hljs-comment * { .k { font-weight: bold; }
color: #006a00; .o { font-weight: bold; }
} .cm { color: #999988; font-style: italic; }
.cp { color: #999999; font-weight: bold; }
.hljs-keyword, .c1 { color: #999988; font-style: italic; }
.hljs-literal, .cs { color: #999999; font-weight: bold; font-style: italic; }
.nginx .hljs-title { .gd { color: #000000; background-color: #ffdddd; }
color: #aa0d91; .gd .x { color: #000000; background-color: #ffaaaa; }
} .ge { font-style: italic; }
.method, .gr { color: #aa0000; }
.hljs-list .hljs-title, .gh { color: #999999; }
.hljs-tag .hljs-title, .gi { color: #000000; background-color: #ddffdd; }
.setting .hljs-value, .gi .x { color: #000000; background-color: #aaffaa; }
.hljs-winutils, .go { color: #888888; }
.tex .hljs-command, .gp { color: #555555; }
.http .hljs-title, .gs { font-weight: bold; }
.hljs-request, .gu { color: #800080; font-weight: bold; }
.hljs-status { .gt { color: #aa0000; }
color: #008; .kc { font-weight: bold; }
} .kd { font-weight: bold; }
.kn { font-weight: bold; }
.hljs-envvar, .kp { font-weight: bold; }
.tex .hljs-special { .kr { font-weight: bold; }
color: #660; .kt { color: #445588; font-weight: bold; }
} .m { color: #009999; }
.s { color: #dd1144; }
.hljs-string { .n { color: #333333; }
color: #c41a16; .na { color: teal; }
} .nb { color: #0086b3; }
.hljs-tag .hljs-value, .nc { color: #445588; font-weight: bold; }
.hljs-cdata, .no { color: teal; }
.hljs-filter .hljs-argument, .ni { color: purple; }
.hljs-attr_selector, .ne { color: #990000; font-weight: bold; }
.apache .hljs-cbracket, .nf { color: #990000; font-weight: bold; }
.hljs-date, .nn { color: #555555; }
.hljs-regexp { .nt { color: navy; }
color: #080; .nv { color: teal; }
} .ow { font-weight: bold; }
.w { color: #bbbbbb; }
.hljs-sub .hljs-identifier, .mf { color: #009999; }
.hljs-pi, .mh { color: #009999; }
.hljs-tag, .mi { color: #009999; }
.hljs-tag .hljs-keyword, .mo { color: #009999; }
.hljs-decorator, .sb { color: #dd1144; }
.ini .hljs-title, .sc { color: #dd1144; }
.hljs-shebang, .sd { color: #dd1144; }
.hljs-prompt, .s2 { color: #dd1144; }
.hljs-hexcolor, .se { color: #dd1144; }
.hljs-rules .hljs-value, .sh { color: #dd1144; }
.hljs-symbol, .si { color: #dd1144; }
.hljs-symbol .hljs-string, .sx { color: #dd1144; }
.hljs-number, .sr { color: #009926; }
.css .hljs-function, .s1 { color: #dd1144; }
.clojure .hljs-title, .ss { color: #990073; }
.clojure .hljs-built_in, .bp { color: #999999; }
.hljs-function .hljs-title, .vc { color: teal; }
.coffeescript .hljs-attribute { .vg { color: teal; }
color: #1c00cf; .vi { color: teal; }
} .il { color: #009999; }
.gc { color: #999; background-color: #EAF2F5; }
.hljs-class .hljs-title,
.haskell .hljs-type,
.smalltalk .hljs-class,
.hljs-javadoctag,
.hljs-yardoctag,
.hljs-phpdoc,
.hljs-typename,
.hljs-tag .hljs-attribute,
.hljs-doctype,
.hljs-class .hljs-id,
.hljs-built_in,
.setting,
.hljs-params,
.clojure .hljs-attribute {
color: #5c2699;
}
.hljs-variable {
color: #3f6e74;
}
.css .hljs-tag,
.hljs-rules .hljs-property,
.hljs-pseudo,
.hljs-subst {
color: #000;
}
.css .hljs-class,
.css .hljs-id {
color: #9B703F;
}
.hljs-value .hljs-important {
color: #ff7700;
font-weight: bold;
}
.hljs-rules .hljs-keyword {
color: #C5AF75;
}
.hljs-annotation,
.apache .hljs-sqbracket,
.nginx .hljs-built_in {
color: #9B859D;
}
.hljs-preprocessor,
.hljs-preprocessor *,
.hljs-pragma {
color: #643820;
}
.tex .hljs-formula {
background-color: #EEE;
font-style: italic;
}
.diff .hljs-header,
.hljs-chunk {
color: #808080;
font-weight: bold;
}
.diff .hljs-change {
background-color: #BCCFF9;
}
.hljs-addition {
background-color: #BAEEBA;
}
.hljs-deletion {
background-color: #FFC8BD;
}
.hljs-comment .hljs-yardoctag {
font-weight: bold;
}
.method .hljs-id {
color: #000;
}
}
.shadow {
@include box-shadow(0 5px 15px #000);
}
.file-content {
&.code .white {
.highlight {
border-left: 1px solid #eee;
}
}
&.wiki .white {
.highlight, pre, .hljs {
background: #F9F9F9;
}
}
}
.readme-holder .wiki, .note-body, .wiki-holder {
.white {
.highlight, pre, .hljs {
background: #F9F9F9;
}
}
} }

View file

@ -65,7 +65,16 @@
max-width: 100%; max-width: 100%;
} }
code { padding: 0 4px; } *:first-child {
margin-top: 0;
}
code {
font-family: $monospace_font;
white-space: pre;
word-wrap: normal;
padding: 0;
}
h1 { h1 {
margin-top: 45px; margin-top: 45px;

View file

@ -98,6 +98,11 @@
background: #f1f1f1; background: #f1f1f1;
border-left: 1px solid #DDD; border-left: 1px solid #DDD;
} }
td.lines {
code {
font-family: $monospace_font;
}
}
} }
} }

View file

@ -5,8 +5,9 @@ module ApplicationHelper
COLOR_SCHEMES = { COLOR_SCHEMES = {
1 => 'white', 1 => 'white',
2 => 'dark', 2 => 'dark',
3 => 'solarized-dark', 3 => 'solarized-light',
4 => 'monokai', 4 => 'solarized-dark',
5 => 'monokai',
} }
COLOR_SCHEMES.default = 'white' COLOR_SCHEMES.default = 'white'
@ -189,20 +190,6 @@ module ApplicationHelper
BroadcastMessage.current BroadcastMessage.current
end end
def highlight_js(&block)
string = capture(&block)
content_tag :div, class: "highlighted-data #{user_color_scheme_class}" do
content_tag :div, class: 'highlight' do
content_tag :pre do
content_tag :code do
string.html_safe
end
end
end
end
end
def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
capture_haml do capture_haml do
haml_tag :time, date.to_s, haml_tag :time, date.to_s,

View file

@ -1,10 +1,19 @@
module BlobHelper module BlobHelper
def highlightjs_class(blob_name) def highlight(blob_name, blob_content, nowrap = false)
if no_highlight_files.include?(blob_name.downcase) formatter = Rugments::Formatters::HTML.new(
'no-highlight' nowrap: nowrap,
else cssclass: 'code highlight',
blob_name.downcase lineanchors: true,
lineanchorsid: 'LC'
)
begin
lexer = Rugments::Lexer.guess(filename: blob_name, source: blob_content)
rescue Rugments::Lexer::AmbiguousGuess
lexer = Rugments::Lexers::PlainText
end end
formatter.format(lexer.lex(blob_content)).html_safe
end end
def no_highlight_files def no_highlight_files

View file

@ -26,9 +26,9 @@
= i = i
\ \
%td.lines %td.lines
%pre %pre{class: 'code highlight white'}
%code{ class: highlightjs_class(@blob.name) } %code
:erb :erb
<% lines.each do |line| %> <% lines.each do |line| %>
<%= line %> <%= highlight(@blob.name, line, true).html_safe %>
<% end %> <% end %>

View file

@ -8,6 +8,6 @@
- else - else
.file-content.code .file-content.code
- unless blob.empty? - unless blob.empty?
= render 'shared/file_hljs', blob: blob = render 'shared/file_highlight', blob: blob
- else - else
.nothing-here-block Empty file .nothing-here-block Empty file

View file

@ -24,7 +24,7 @@
%td %td
= commit.message = commit.message
%td %td
#{time_ago_with_tooltip(version.date)} #{time_ago_with_tooltip(version.authored_date)}
%td %td
%strong %strong
= @page.page.wiki.page(@page.page.name, commit.id).try(:format) = @page.page.wiki.page(@page.page.name, commit.id).try(:format)

View file

@ -6,4 +6,4 @@
%strong %strong
= blob.filename = blob.filename
.file-content.code.term .file-content.code.term
= render 'shared/file_hljs', blob: blob, first_line_number: blob.startline = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, user_color_scheme_class: 'white'

View file

@ -6,4 +6,4 @@
%strong %strong
= wiki_blob.filename = wiki_blob.filename
.file-content.code.term .file-content.code.term
= render 'shared/file_hljs', blob: wiki_blob, first_line_number: wiki_blob.startline = render 'shared/file_highlight', blob: wiki_blob, first_line_number: wiki_blob.startline, user_color_scheme_class: 'white'

View file

@ -1,4 +1,4 @@
%div.highlighted-data{class: user_color_scheme_class} .file-content.code{class: user_color_scheme_class}
.line-numbers .line-numbers
- if blob.data.present? - if blob.data.present?
- blob.data.lines.to_a.size.times do |index| - blob.data.lines.to_a.size.times do |index|
@ -7,7 +7,4 @@
= link_to "#L#{i}", id: "L#{i}", rel: "#L#{i}" do = link_to "#L#{i}", id: "L#{i}", rel: "#L#{i}" do
%i.fa.fa-link %i.fa.fa-link
= i = i
.highlight = highlight(blob.name, blob.data)
%pre
%code{ class: highlightjs_class(blob.name) }
#{blob.data}

View file

@ -8,7 +8,7 @@
= render_markup(@snippet.file_name, @snippet.data) = render_markup(@snippet.file_name, @snippet.data)
- else - else
.file-content.code .file-content.code
= render 'shared/file_hljs', blob: @snippet = render 'shared/file_highlight', blob: @snippet
- else - else
.file-content.code .file-content.code
.nothing-here-block Empty file .nothing-here-block Empty file

View file

@ -21,23 +21,22 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
text.gsub("'", "&rsquo;") text.gsub("'", "&rsquo;")
end end
# Stolen from Rugments::Plugins::Redcarpet as this module is not required
# from Rugments's gem root.
def block_code(code, language) def block_code(code, language)
# New lines are placed to fix an rendering issue lexer = Rugments::Lexer.find_fancy(language, code) || Rugments::Lexers::PlainText
# with code wrapped inside <h1> tag for next case:
#
# # Title kinda h1
#
# ruby code here
#
<<-HTML
<div class="highlighted-data #{h.user_color_scheme_class}"> # XXX HACK: Redcarpet strips hard tabs out of code blocks,
<div class="highlight"> # so we assume you're not using leading spaces that aren't tabs,
<pre><code class="#{language}">#{h.send(:html_escape, code)}</code></pre> # and just replace them here.
</div> if lexer.tag == 'make'
</div> code.gsub! /^ /, "\t"
end
HTML formatter = Rugments::Formatters::HTML.new(
cssclass: "code highlight white #{lexer.tag}"
)
formatter.format(lexer.lex(code))
end end
def link(link, title, content) def link(link, title, content)

View file

@ -26,7 +26,8 @@ describe EventsHelper do
it 'should display the first line of a code block' do it 'should display the first line of a code block' do
input = "```\nCode block\nwith two lines\n```" input = "```\nCode block\nwith two lines\n```"
expected = '<pre><code class="">Code block...</code></pre>' expected = '<pre class="code highlight white plaintext"><code>' \
'Code block...</code></pre>'
expect(event_note(input)).to match(expected) expect(event_note(input)).to match(expected)
end end

View file

@ -566,7 +566,7 @@ describe GitlabMarkdownHelper do
it "should leave code blocks untouched" do it "should leave code blocks untouched" do
helper.stub(:user_color_scheme_class).and_return(:white) helper.stub(:user_color_scheme_class).and_return(:white)
target_html = "\n<div class=\"highlighted-data white\">\n <div class=\"highlight\">\n <pre><code class=\"\">some code from $#{snippet.id}\nhere too\n</code></pre>\n </div>\n</div>\n\n" target_html = "<pre class=\"code highlight white plaintext\"><code>some code from $40\nhere too\n</code></pre>\n"
helper.markdown("\n some code from $#{snippet.id}\n here too\n").should == target_html helper.markdown("\n some code from $#{snippet.id}\n here too\n").should == target_html
helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should == target_html helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should == target_html

View file

@ -36,7 +36,7 @@ describe WikiPage do
end end
it "sets the version attribute" do it "sets the version attribute" do
@wiki_page.version.should be_a Grit::Commit @wiki_page.version.should be_a Gollum::Git::Commit
end end
end end
end end

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
.hljs{display:block;padding:.5em;background:#f0f0f0}.hljs,.hljs-subst,.hljs-tag .hljs-title,.lisp .hljs-title,.clojure .hljs-built_in,.nginx .hljs-title{color:black}.hljs-string,.hljs-title,.hljs-constant,.hljs-parent,.hljs-tag .hljs-value,.hljs-rules .hljs-value,.hljs-rules .hljs-value .hljs-number,.hljs-preprocessor,.hljs-pragma,.haml .hljs-symbol,.ruby .hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-aggregate,.hljs-template_tag,.django .hljs-variable,.smalltalk .hljs-class,.hljs-addition,.hljs-flow,.hljs-stream,.bash .hljs-variable,.apache .hljs-tag,.apache .hljs-cbracket,.tex .hljs-command,.tex .hljs-special,.erlang_repl .hljs-function_or_atom,.asciidoc .hljs-header,.markdown .hljs-header,.coffeescript .hljs-attribute{color:#800}.smartquote,.hljs-comment,.hljs-annotation,.hljs-template_comment,.diff .hljs-header,.hljs-chunk,.asciidoc .hljs-blockquote,.markdown .hljs-blockquote{color:#888}.hljs-number,.hljs-date,.hljs-regexp,.hljs-literal,.hljs-hexcolor,.smalltalk .hljs-symbol,.smalltalk .hljs-char,.go .hljs-constant,.hljs-change,.lasso .hljs-variable,.makefile .hljs-variable,.asciidoc .hljs-bullet,.markdown .hljs-bullet,.asciidoc .hljs-link_url,.markdown .hljs-link_url{color:#080}.hljs-label,.hljs-javadoc,.ruby .hljs-string,.hljs-decorator,.hljs-filter .hljs-argument,.hljs-localvars,.hljs-array,.hljs-attr_selector,.hljs-important,.hljs-pseudo,.hljs-pi,.haml .hljs-bullet,.hljs-doctype,.hljs-deletion,.hljs-envvar,.hljs-shebang,.apache .hljs-sqbracket,.nginx .hljs-built_in,.tex .hljs-formula,.erlang_repl .hljs-reserved,.hljs-prompt,.asciidoc .hljs-link_label,.markdown .hljs-link_label,.vhdl .hljs-attribute,.clojure .hljs-attribute,.asciidoc .hljs-attribute,.lasso .hljs-attribute,.coffeescript .hljs-property,.hljs-phony{color:#88F}.hljs-keyword,.hljs-id,.hljs-title,.hljs-built_in,.hljs-aggregate,.css .hljs-tag,.hljs-javadoctag,.hljs-phpdoc,.hljs-yardoctag,.smalltalk .hljs-class,.hljs-winutils,.bash .hljs-variable,.apache .hljs-tag,.go .hljs-typename,.tex .hljs-command,.asciidoc .hljs-strong,.markdown .hljs-strong,.hljs-request,.hljs-status{font-weight:bold}.asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic}.nginx .hljs-built_in{font-weight:normal}.coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}