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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1bf3e157
Commit
1bf3e157
authored
Jul 09, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly render plain readme
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3cdd6847
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
app/assets/stylesheets/generic/typography.scss
app/assets/stylesheets/generic/typography.scss
+8
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-0
lib/gitlab/markup_helper.rb
lib/gitlab/markup_helper.rb
+10
-0
No files found.
app/assets/stylesheets/generic/typography.scss
View file @
1bf3e157
...
@@ -17,6 +17,14 @@ pre {
...
@@ -17,6 +17,14 @@ pre {
background
:
#333
;
background
:
#333
;
color
:
$background-color
;
color
:
$background-color
;
}
}
&
.plain-readme
{
background
:
none
;
border
:
none
;
padding
:
0
;
margin
:
0
;
font-size
:
14px
;
}
}
}
.monospace
{
.monospace
{
...
...
app/helpers/application_helper.rb
View file @
1bf3e157
...
@@ -213,6 +213,10 @@ module ApplicationHelper
...
@@ -213,6 +213,10 @@ module ApplicationHelper
Haml
::
Helpers
.
preserve
(
markdown
(
file_content
))
Haml
::
Helpers
.
preserve
(
markdown
(
file_content
))
elsif
asciidoc?
(
file_name
)
elsif
asciidoc?
(
file_name
)
asciidoc
(
file_content
)
asciidoc
(
file_content
)
elsif
plain?
(
file_name
)
content_tag
:pre
,
class:
'plain-readme'
do
file_content
end
else
else
GitHub
::
Markup
.
render
(
file_name
,
file_content
).
GitHub
::
Markup
.
render
(
file_name
,
file_content
).
force_encoding
(
file_content
.
encoding
).
html_safe
force_encoding
(
file_content
.
encoding
).
html_safe
...
@@ -221,6 +225,10 @@ module ApplicationHelper
...
@@ -221,6 +225,10 @@ module ApplicationHelper
simple_format
(
file_content
)
simple_format
(
file_content
)
end
end
def
plain?
(
filename
)
Gitlab
::
MarkupHelper
.
plain?
(
filename
)
end
def
markup?
(
filename
)
def
markup?
(
filename
)
Gitlab
::
MarkupHelper
.
markup?
(
filename
)
Gitlab
::
MarkupHelper
.
markup?
(
filename
)
end
end
...
...
lib/gitlab/markup_helper.rb
View file @
1bf3e157
...
@@ -33,6 +33,16 @@ module Gitlab
...
@@ -33,6 +33,16 @@ module Gitlab
filename
.
downcase
.
end_with?
(
*
%w(.adoc .ad .asciidoc)
)
filename
.
downcase
.
end_with?
(
*
%w(.adoc .ad .asciidoc)
)
end
end
# Public: Determines if the given filename is plain text.
#
# filename - Filename string to check
#
# Returns boolean
def
plain?
(
filename
)
filename
.
downcase
.
end_with?
(
'.txt'
)
||
filename
.
downcase
==
'readme'
end
def
previewable?
(
filename
)
def
previewable?
(
filename
)
markup?
(
filename
)
markup?
(
filename
)
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