2014-09-02 18:07:02 +05:30
|
|
|
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
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
def previewable?(filename)
|
|
|
|
gitlab_markdown?(filename) || markup?(filename)
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|