Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2015-05-13 02:07:48 +0300
committerJakub Jirutka <jakub@jirutka.cz>2015-05-18 21:48:03 +0300
commit8dbc4746fe7c723b67f3c90cbf40fd7bf6c29cb7 (patch)
tree268aba3884c8e2e09fdefda9cad7a4c569154cc2 /app/helpers/gitlab_markdown_helper.rb
parentdc348baf18240dc05e209ec781daada2cbcfe16f (diff)
Handle AsciiDoc better, reuse HTML pipeline filters (fixes #9263)
Diffstat (limited to 'app/helpers/gitlab_markdown_helper.rb')
-rw-r--r--app/helpers/gitlab_markdown_helper.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 846aded4bda..7bcc011fd5f 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -56,6 +56,16 @@ module GitlabMarkdownHelper
@markdown.render(text).html_safe
end
+ def asciidoc(text)
+ Gitlab::Asciidoc.render(text, {
+ commit: @commit,
+ project: @project,
+ project_wiki: @project_wiki,
+ requested_path: @path,
+ ref: @ref
+ })
+ end
+
# Return the first line of +text+, up to +max_chars+, after parsing the line
# as Markdown. HTML tags in the parsed output are not counted toward the
# +max_chars+ limit. If the length limit falls within a tag's contents, then
@@ -67,8 +77,11 @@ module GitlabMarkdownHelper
end
def render_wiki_content(wiki_page)
- if wiki_page.format == :markdown
+ case wiki_page.format
+ when :markdown
markdown(wiki_page.content)
+ when :asciidoc
+ asciidoc(wiki_page.content)
else
wiki_page.formatted_content.html_safe
end