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
ccb706d3
Commit
ccb706d3
authored
Nov 02, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor MarkupHelper to add INDEX plain filename
parent
75917c51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
lib/gitlab/markup_helper.rb
lib/gitlab/markup_helper.rb
+9
-4
No files found.
lib/gitlab/markup_helper.rb
View file @
ccb706d3
...
@@ -4,10 +4,11 @@ module Gitlab
...
@@ -4,10 +4,11 @@ module Gitlab
module
MarkupHelper
module
MarkupHelper
extend
self
extend
self
MARKDOWN_EXTENSIONS
=
%w
(mdown mkd mkdn md markdown)
.
freeze
MARKDOWN_EXTENSIONS
=
%w
[mdown mkd mkdn md markdown]
.
freeze
ASCIIDOC_EXTENSIONS
=
%w
(adoc ad asciidoc)
.
freeze
ASCIIDOC_EXTENSIONS
=
%w
[adoc ad asciidoc]
.
freeze
OTHER_EXTENSIONS
=
%w
(textile rdoc org creole wiki mediawiki rst)
.
freeze
OTHER_EXTENSIONS
=
%w
[textile rdoc org creole wiki mediawiki rst]
.
freeze
EXTENSIONS
=
MARKDOWN_EXTENSIONS
+
ASCIIDOC_EXTENSIONS
+
OTHER_EXTENSIONS
EXTENSIONS
=
MARKDOWN_EXTENSIONS
+
ASCIIDOC_EXTENSIONS
+
OTHER_EXTENSIONS
PLAIN_FILENAMES
=
%w[readme index]
.
freeze
# Public: Determines if a given filename is compatible with GitHub::Markup.
# Public: Determines if a given filename is compatible with GitHub::Markup.
#
#
...
@@ -43,7 +44,7 @@ module Gitlab
...
@@ -43,7 +44,7 @@ module Gitlab
#
#
# Returns boolean
# Returns boolean
def
plain?
(
filename
)
def
plain?
(
filename
)
extension
(
filename
)
==
'txt'
||
filename
.
casecmp
(
'readme'
).
zero?
extension
(
filename
)
==
'txt'
||
plain_filename?
(
filename
)
end
end
def
previewable?
(
filename
)
def
previewable?
(
filename
)
...
@@ -55,5 +56,9 @@ module Gitlab
...
@@ -55,5 +56,9 @@ module Gitlab
def
extension
(
filename
)
def
extension
(
filename
)
File
.
extname
(
filename
).
downcase
.
delete
(
'.'
)
File
.
extname
(
filename
).
downcase
.
delete
(
'.'
)
end
end
def
plain_filename?
(
filename
)
PLAIN_FILENAMES
.
include?
(
filename
.
downcase
)
end
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