BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5f239093
Unverified
Commit
5f239093
authored
Nov 17, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove code duplication in gitlab_markdown_helper.rb
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
bfbfa3b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
28 deletions
+24
-28
gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+24
-28
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
5f239093
...
...
@@ -46,39 +46,13 @@ module GitlabMarkdownHelper
end
def
markdown
(
text
,
context
=
{})
return
""
unless
text
.
present?
context
.
reverse_merge!
(
path:
@path
,
pipeline: :default
,
project:
@project
,
project_wiki:
@project_wiki
,
ref:
@ref
)
user
=
current_user
if
defined?
(
current_user
)
html
=
Gitlab
::
Markdown
.
render
(
text
,
context
)
Gitlab
::
Markdown
.
post_process
(
html
,
pipeline:
context
[
:pipeline
],
project:
@project
,
user:
user
)
process_markdown
(
text
,
options
)
end
# TODO (rspeicher): Remove all usages of this helper and just call `markdown`
# with a custom pipeline depending on the content being rendered
def
gfm
(
text
,
options
=
{})
return
""
unless
text
.
present?
options
.
reverse_merge!
(
path:
@path
,
pipeline: :default
,
project:
@project
,
project_wiki:
@project_wiki
,
ref:
@ref
)
user
=
current_user
if
defined?
(
current_user
)
html
=
Gitlab
::
Markdown
.
gfm
(
text
,
options
)
Gitlab
::
Markdown
.
post_process
(
html
,
pipeline:
options
[
:pipeline
],
project:
@project
,
user:
user
)
process_markdown
(
text
,
options
,
:gfm
)
end
def
asciidoc
(
text
)
...
...
@@ -204,4 +178,26 @@ module GitlabMarkdownHelper
''
end
end
def
process_markdown
(
text
,
options
,
method
=
:markdown
)
return
""
unless
text
.
present?
options
.
reverse_merge!
(
path:
@path
,
pipeline: :default
,
project:
@project
,
project_wiki:
@project_wiki
,
ref:
@ref
)
user
=
current_user
if
defined?
(
current_user
)
html
=
if
method
==
:gfm
Gitlab
::
Markdown
.
gfm
(
text
,
options
)
else
Gitlab
::
Markdown
.
render
(
text
,
options
)
end
Gitlab
::
Markdown
.
post_process
(
html
,
pipeline:
options
[
:pipeline
],
project:
@project
,
user:
user
)
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