From 08ca9411865a9dff5354f0e7ec214fba6af4e9d9 Mon Sep 17 00:00:00 2001
From: Robert Speicher <rspeicher@gmail.com>
Date: Mon, 31 Aug 2015 16:22:34 -0400
Subject: [PATCH] Move REDCARPET_OPTIONS to a private method

There wasn't really a reason to have them as a constant, and we were
getting "already defined" warnings which are always annoying.
---
 lib/gitlab/markdown.rb | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 7efcbaf3252..097caf67a65 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -5,18 +5,6 @@ module Gitlab
   #
   # See the files in `lib/gitlab/markdown/` for specific processing information.
   module Markdown
-    # https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
-    REDCARPET_OPTIONS = {
-      no_intra_emphasis:   true,
-      tables:              true,
-      fenced_code_blocks:  true,
-      strikethrough:       true,
-      lax_spacing:         true,
-      space_after_headers: true,
-      superscript:         true,
-      footnotes:           true
-    }.freeze
-
     # Convert a Markdown String into an HTML-safe String of HTML
     #
     # markdown - Markdown String
@@ -40,7 +28,7 @@ module Gitlab
     #
     # Returns a String
     def self.render_without_gfm(markdown)
-      self.renderer.render(markdown)
+      renderer.render(markdown)
     end
 
     # Provide autoload paths for filters to prevent a circular dependency error
@@ -123,10 +111,24 @@ module Gitlab
     def self.renderer
       @markdown ||= begin
         renderer = Redcarpet::Render::HTML.new
-        Redcarpet::Markdown.new(renderer, REDCARPET_OPTIONS)
+        Redcarpet::Markdown.new(renderer, redcarpet_options)
       end
     end
 
+    def self.redcarpet_options
+      # https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
+      @redcarpet_options ||= {
+        fenced_code_blocks:  true,
+        footnotes:           true,
+        lax_spacing:         true,
+        no_intra_emphasis:   true,
+        space_after_headers: true,
+        strikethrough:       true,
+        superscript:         true,
+        tables:              true
+      }.freeze
+    end
+
     # Filters used in our pipeline
     #
     # SanitizationFilter should come first so that all generated reference HTML
-- 
GitLab