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

markdown_helper.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e3cfc0585b32470139ea8666be689ad17ab25ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Gitlab
  module MarkdownHelper
    module_function

    # Public: Determines if a given filename is compatible with GitHub::Markup.
    #
    # filename - Filename string to check
    #
    # Returns boolean
    def markup?(filename)
      filename.downcase.end_with?(*%w(.textile .rdoc .org .creole .wiki
                                      .mediawiki .rst .adoc .asciidoc .asc))
    end

    # Public: Determines if a given filename is compatible with
    # GitLab-flavored Markdown.
    #
    # filename - Filename string to check
    #
    # Returns boolean
    def gitlab_markdown?(filename)
      filename.downcase.end_with?(*%w(.mdown .md .markdown))
    end

    def previewable?(filename)
      gitlab_markdown?(filename) || markup?(filename)
    end
  end
end