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
Tatuya Kamada
gitlab-ce
Commits
f65840bc
Commit
f65840bc
authored
Oct 22, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Markdown XHTML context param
parent
abbca615
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+10
-9
No files found.
lib/gitlab/markdown.rb
View file @
f65840bc
...
@@ -20,8 +20,6 @@ module Gitlab
...
@@ -20,8 +20,6 @@ module Gitlab
#
#
# Returns an HTML-safe String
# Returns an HTML-safe String
def
self
.
render
(
text
,
context
=
{})
def
self
.
render
(
text
,
context
=
{})
context
[
:pipeline
]
||=
:full
cache_key
=
context
.
delete
(
:cache_key
)
cache_key
=
context
.
delete
(
:cache_key
)
cache_key
=
full_cache_key
(
cache_key
,
context
[
:pipeline
])
cache_key
=
full_cache_key
(
cache_key
,
context
[
:pipeline
])
...
@@ -35,8 +33,7 @@ module Gitlab
...
@@ -35,8 +33,7 @@ module Gitlab
end
end
def
self
.
render_result
(
text
,
context
=
{})
def
self
.
render_result
(
text
,
context
=
{})
pipeline_type
=
context
[
:pipeline
]
||=
:full
pipeline_by_name
(
context
[
:pipeline
]).
call
(
text
,
context
)
pipeline_by_type
(
pipeline_type
).
call
(
text
,
context
)
end
end
# Perform post-processing on an HTML String
# Perform post-processing on an HTML String
...
@@ -53,7 +50,10 @@ module Gitlab
...
@@ -53,7 +50,10 @@ module Gitlab
#
#
# Returns an HTML-safe String
# Returns an HTML-safe String
def
self
.
post_process
(
html
,
context
)
def
self
.
post_process
(
html
,
context
)
pipeline
=
pipeline_by_type
(
:post_process
)
pipeline
=
pipeline_by_name
(
context
[
:pipeline
])
context
=
pipeline
.
transform_context
(
context
)
pipeline
=
pipeline_by_name
(
:post_process
)
if
context
[
:xhtml
]
if
context
[
:xhtml
]
pipeline
.
to_document
(
html
,
context
).
to_html
(
save_with:
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
)
pipeline
.
to_document
(
html
,
context
).
to_html
(
save_with:
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
)
...
@@ -74,14 +74,15 @@ module Gitlab
...
@@ -74,14 +74,15 @@ module Gitlab
end
end
end
end
def
self
.
full_cache_key
(
cache_key
,
pipeline
=
:full
)
def
self
.
full_cache_key
(
cache_key
,
pipeline
_name
)
return
unless
cache_key
return
unless
cache_key
pipeline_name
||=
:full
[
"markdown"
,
*
cache_key
,
pipeline
]
[
"markdown"
,
*
cache_key
,
pipeline
]
end
end
def
self
.
pipeline_by_type
(
pipeline_type
)
def
self
.
pipeline_by_name
(
pipeline_name
)
const_get
(
"
#{
pipeline_type
.
to_s
.
camelize
}
Pipeline"
)
pipeline_name
||=
:full
const_get
(
"
#{
pipeline_name
.
to_s
.
camelize
}
Pipeline"
)
end
end
# Provide autoload paths for filters to prevent a circular dependency error
# Provide autoload paths for filters to prevent a circular dependency error
...
...
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