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
daa09250
Commit
daa09250
authored
May 13, 2015
by
Jakub Jirutka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename MarkdownHelper to MarkupHelper
parent
b61a44fe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+3
-3
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+1
-1
app/models/tree.rb
app/models/tree.rb
+3
-3
lib/gitlab/markup_helper.rb
lib/gitlab/markup_helper.rb
+1
-1
spec/lib/gitlab/markup_helper_spec.rb
spec/lib/gitlab/markup_helper_spec.rb
+7
-7
No files found.
app/helpers/application_helper.rb
View file @
daa09250
...
...
@@ -233,15 +233,15 @@ module ApplicationHelper
end
def
markup?
(
filename
)
Gitlab
::
Mark
down
Helper
.
markup?
(
filename
)
Gitlab
::
Mark
up
Helper
.
markup?
(
filename
)
end
def
gitlab_markdown?
(
filename
)
Gitlab
::
Mark
down
Helper
.
gitlab_markdown?
(
filename
)
Gitlab
::
Mark
up
Helper
.
gitlab_markdown?
(
filename
)
end
def
asciidoc?
(
filename
)
Gitlab
::
Mark
down
Helper
.
asciidoc?
(
filename
)
Gitlab
::
Mark
up
Helper
.
asciidoc?
(
filename
)
end
# Overrides ActionView::Helpers::UrlHelper#link_to to add `rel="nofollow"` to
...
...
app/helpers/blob_helper.rb
View file @
daa09250
...
...
@@ -55,7 +55,7 @@ module BlobHelper
end
def
editing_preview_title
(
filename
)
if
Gitlab
::
Mark
down
Helper
.
previewable?
(
filename
)
if
Gitlab
::
Mark
up
Helper
.
previewable?
(
filename
)
'Preview'
else
'Preview changes'
...
...
app/models/tree.rb
View file @
daa09250
class
Tree
include
Gitlab
::
Mark
down
Helper
include
Gitlab
::
Mark
up
Helper
attr_accessor
:repository
,
:sha
,
:path
,
:entries
def
initialize
(
repository
,
sha
,
path
=
'/'
)
path
=
'/'
if
path
.
blank?
@repository
=
repository
@sha
=
sha
@path
=
path
...
...
@@ -20,7 +20,7 @@ class Tree
available_readmes
=
blobs
.
select
(
&
:readme?
)
if
available_readmes
.
count
==
0
return
@readme
=
nil
return
@readme
=
nil
end
# Take the first previewable readme, or the first available readme, if we
...
...
lib/gitlab/mark
down
_helper.rb
→
lib/gitlab/mark
up
_helper.rb
View file @
daa09250
module
Gitlab
module
Mark
down
Helper
module
Mark
up
Helper
module_function
# Public: Determines if a given filename is compatible with GitHub::Markup.
...
...
spec/lib/gitlab/
gitlab_markdown
_helper_spec.rb
→
spec/lib/gitlab/
markup
_helper_spec.rb
View file @
daa09250
require
'spec_helper'
describe
Gitlab
::
Mark
down
Helper
do
describe
Gitlab
::
Mark
up
Helper
do
describe
'#markup?'
do
%w(textile rdoc org creole wiki
mediawiki rst adoc ad asciidoc)
.
each
do
|
type
|
it
"returns true for
#{
type
}
files"
do
expect
(
Gitlab
::
Mark
down
Helper
.
markup?
(
"README.
#{
type
}
"
)).
to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
markup?
(
"README.
#{
type
}
"
)).
to
be_truthy
end
end
it
'returns false when given a non-markup filename'
do
expect
(
Gitlab
::
Mark
down
Helper
.
markup?
(
'README.rb'
)).
not_to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
markup?
(
'README.rb'
)).
not_to
be_truthy
end
end
describe
'#gitlab_markdown?'
do
%w(mdown md markdown)
.
each
do
|
type
|
it
"returns true for
#{
type
}
files"
do
expect
(
Gitlab
::
Mark
down
Helper
.
gitlab_markdown?
(
"README.
#{
type
}
"
)).
to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
gitlab_markdown?
(
"README.
#{
type
}
"
)).
to
be_truthy
end
end
it
'returns false when given a non-markdown filename'
do
expect
(
Gitlab
::
Mark
down
Helper
.
gitlab_markdown?
(
'README.rb'
)).
not_to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
gitlab_markdown?
(
'README.rb'
)).
not_to
be_truthy
end
end
describe
'#asciidoc?'
do
%w(adoc ad asciidoc ADOC)
.
each
do
|
type
|
it
"returns true for
#{
type
}
files"
do
expect
(
Gitlab
::
Mark
down
Helper
.
asciidoc?
(
"README.
#{
type
}
"
)).
to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
asciidoc?
(
"README.
#{
type
}
"
)).
to
be_truthy
end
end
it
'returns false when given a non-asciidoc filename'
do
expect
(
Gitlab
::
Mark
down
Helper
.
asciidoc?
(
'README.rb'
)).
not_to
be_truthy
expect
(
Gitlab
::
Mark
up
Helper
.
asciidoc?
(
'README.rb'
)).
not_to
be_truthy
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