Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7acd0604
Commit
7acd0604
authored
Nov 27, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2095 from riyad/fix-code-highlighting
Fix code highlighting
parents
99e1d9d8
dc99b19a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
18 deletions
+26
-18
app/assets/stylesheets/gitlab_bootstrap/files.scss
app/assets/stylesheets/gitlab_bootstrap/files.scss
+2
-2
app/assets/stylesheets/highlight/dark.scss
app/assets/stylesheets/highlight/dark.scss
+5
-3
app/assets/stylesheets/highlight/white.scss
app/assets/stylesheets/highlight/white.scss
+5
-3
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+4
-0
app/views/snippets/_blob.html.haml
app/views/snippets/_blob.html.haml
+2
-3
app/views/tree/blob/_text.html.haml
app/views/tree/blob/_text.html.haml
+2
-3
lib/redcarpet/render/gitlab_html.rb
lib/redcarpet/render/gitlab_html.rb
+6
-4
No files found.
app/assets/stylesheets/gitlab_bootstrap/files.scss
View file @
7acd0604
...
@@ -95,8 +95,8 @@
...
@@ -95,8 +95,8 @@
pre
{
pre
{
padding
:
0
;
padding
:
0
;
margin
:
0
;
margin
:
0
;
background
:none
;
border
:none
;
border
:none
;
border-radius
:
0
;
}
}
}
}
}
}
...
@@ -142,8 +142,8 @@
...
@@ -142,8 +142,8 @@
table-layout
:
fixed
;
table-layout
:
fixed
;
pre
{
pre
{
background
:
none
;
border
:
none
;
border
:
none
;
border-radius
:
0
;
font-family
:
'Menlo'
,
'Liberation Mono'
,
'Consolas'
,
'Courier New'
,
'andale mono'
,
'lucida console'
,
monospace
;
font-family
:
'Menlo'
,
'Liberation Mono'
,
'Consolas'
,
'Courier New'
,
'andale mono'
,
'lucida console'
,
monospace
;
font-size
:
12px
!
important
;
font-size
:
12px
!
important
;
line-height
:
16px
!
important
;
line-height
:
16px
!
important
;
...
...
app/assets/stylesheets/highlight/dark.scss
View file @
7acd0604
.black
.lines
.highlight
{
.black
.highlight
{
background
:
#333
;
pre
{
pre
{
color
:
#eee
;
}
background-color
:
#333
;
color
:
#eee
;
}
.hll
{
display
:
block
;
background-color
:
darken
(
$hover
,
65%
)
}
.hll
{
display
:
block
;
background-color
:
darken
(
$hover
,
65%
)
}
.c
{
color
:
#888888
;
font-style
:
italic
}
/* Comment */
.c
{
color
:
#888888
;
font-style
:
italic
}
/* Comment */
...
...
app/assets/stylesheets/highlight/white.scss
View file @
7acd0604
.white
.lines
.highlight
{
.white
.highlight
{
background
:
white
;
pre
{
pre
{
color
:
#333
;
}
background-color
:
#fff
;
color
:
#333
;
}
.hll
{
display
:
block
;
background-color
:
$hover
}
.hll
{
display
:
block
;
background-color
:
$hover
}
.c
{
color
:
#888888
;
font-style
:
italic
}
/* Comment */
.c
{
color
:
#888888
;
font-style
:
italic
}
/* Comment */
...
...
app/helpers/application_helper.rb
View file @
7acd0604
...
@@ -126,6 +126,10 @@ module ApplicationHelper
...
@@ -126,6 +126,10 @@ module ApplicationHelper
Gitlab
::
Theme
.
css_class_by_id
(
current_user
.
try
(
:theme_id
))
Gitlab
::
Theme
.
css_class_by_id
(
current_user
.
try
(
:theme_id
))
end
end
def
user_color_scheme_class
current_user
.
dark_scheme
?
:black
:
:white
end
def
show_last_push_widget?
(
event
)
def
show_last_push_widget?
(
event
)
event
&&
event
&&
event
.
last_push_to_non_root?
&&
event
.
last_push_to_non_root?
&&
...
...
app/views/snippets/_blob.html.haml
View file @
7acd0604
...
@@ -6,8 +6,7 @@
...
@@ -6,8 +6,7 @@
=
link_to
"raw"
,
raw_project_snippet_path
(
@project
,
@snippet
),
class:
"btn very_small"
,
target:
"_blank"
=
link_to
"raw"
,
raw_project_snippet_path
(
@project
,
@snippet
),
class:
"btn very_small"
,
target:
"_blank"
.file_content.code
.file_content.code
-
unless
@snippet
.
content
.
empty?
-
unless
@snippet
.
content
.
empty?
%div
{
class:
current_user
.
dark_scheme
?
"black"
:
"white"
}
%div
{
class:
user_color_scheme_class
}
:preserve
=
raw
@snippet
.
colorize
(
formatter: :gitlab
)
#{
raw
@snippet
.
colorize
(
formatter: :gitlab
)
}
-
else
-
else
%p
.nothing_here_message
Empty file
%p
.nothing_here_message
Empty file
app/views/tree/blob/_text.html.haml
View file @
7acd0604
...
@@ -8,8 +8,7 @@
...
@@ -8,8 +8,7 @@
-
else
-
else
.file_content.code
.file_content.code
-
unless
blob
.
empty?
-
unless
blob
.
empty?
%div
{
class:
current_user
.
dark_scheme
?
"black"
:
"white"
}
%div
{
class:
user_color_scheme_class
}
=
preserve
do
=
raw
blob
.
colorize
(
formatter: :gitlab
)
=
raw
blob
.
colorize
(
formatter: :gitlab
)
-
else
-
else
%p
.nothing_here_message
Empty file
%p
.nothing_here_message
Empty file
lib/redcarpet/render/gitlab_html.rb
View file @
7acd0604
...
@@ -12,10 +12,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
...
@@ -12,10 +12,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def
block_code
(
code
,
language
)
def
block_code
(
code
,
language
)
options
=
{
options:
{
encoding:
'utf-8'
}
}
options
=
{
options:
{
encoding:
'utf-8'
}
}
if
Pygments
::
Lexer
.
find
(
language
)
h
.
content_tag
:div
,
class:
h
.
user_color_scheme_class
do
Pygments
.
highlight
(
code
,
options
.
merge
(
lexer:
language
.
downcase
))
if
Pygments
::
Lexer
.
find
(
language
)
else
Pygments
.
highlight
(
code
,
options
.
merge
(
lexer:
language
.
downcase
))
Pygments
.
highlight
(
code
,
options
)
else
Pygments
.
highlight
(
code
,
options
)
end
.
html_safe
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment