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:40:11 +0300
committerJakub Jirutka <jakub@jirutka.cz>2015-05-18 23:51:56 +0300
commitdaa0925016a63dcde448643cbf1310aca359cf37 (patch)
tree6b8546fd4cdb2306dc40dec5e444b93d49b1d9de /lib/gitlab/markup_helper.rb
parentb61a44fe1aa17a3e647e71115d1b4a6a39d8c2d2 (diff)
Rename MarkdownHelper to MarkupHelper
Diffstat (limited to 'lib/gitlab/markup_helper.rb')
-rw-r--r--lib/gitlab/markup_helper.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/gitlab/markup_helper.rb b/lib/gitlab/markup_helper.rb
new file mode 100644
index 00000000000..fb037266d23
--- /dev/null
+++ b/lib/gitlab/markup_helper.rb
@@ -0,0 +1,38 @@
+module Gitlab
+ module MarkupHelper
+ 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 .ad .asciidoc))
+ 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
+
+ # Public: Determines if the given filename has AsciiDoc extension.
+ #
+ # filename - Filename string to check
+ #
+ # Returns boolean
+ def asciidoc?(filename)
+ filename.downcase.end_with?(*%w(.adoc .ad .asciidoc))
+ end
+
+ def previewable?(filename)
+ gitlab_markdown?(filename) || markup?(filename)
+ end
+ end
+end