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
iv
gitlab-ce
Commits
74751791
Commit
74751791
authored
Feb 21, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a PreProcessPipeline
parent
1fa7671f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
0 deletions
+28
-0
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+2
-0
lib/banzai.rb
lib/banzai.rb
+4
-0
lib/banzai/pipeline/pre_process_pipeline.rb
lib/banzai/pipeline/pre_process_pipeline.rb
+16
-0
lib/banzai/renderer.rb
lib/banzai/renderer.rb
+6
-0
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
74751791
...
...
@@ -50,6 +50,8 @@ module GitlabMarkdownHelper
context
[
:project
]
||=
@project
text
=
Banzai
.
pre_process
(
text
,
context
)
html
=
Banzai
.
render
(
text
,
context
)
context
.
merge!
(
...
...
lib/banzai.rb
View file @
74751791
...
...
@@ -7,6 +7,10 @@ module Banzai
Renderer
.
render_result
(
text
,
context
)
end
def
self
.
pre_process
(
text
,
context
)
Renderer
.
pre_process
(
text
,
context
)
end
def
self
.
post_process
(
html
,
context
)
Renderer
.
post_process
(
html
,
context
)
end
...
...
lib/banzai/pipeline/pre_process_pipeline.rb
0 → 100644
View file @
74751791
module
Banzai
module
Pipeline
class
PreProcessPipeline
<
BasePipeline
def
self
.
filters
[
]
end
def
self
.
transform_context
(
context
)
context
.
merge
(
pre_process:
true
)
end
end
end
end
lib/banzai/renderer.rb
View file @
74751791
...
...
@@ -31,6 +31,12 @@ module Banzai
Pipeline
[
context
[
:pipeline
]].
call
(
text
,
context
)
end
def
self
.
pre_process
(
text
,
context
)
pipeline
=
Pipeline
[
:pre_process
]
pipeline
.
to_html
(
text
,
context
)
end
# Perform post-processing on an HTML String
#
# This method is used to perform state-dependent changes to a String of
...
...
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