From 453b2ae68b1f127de1deeb745950132542eac667 Mon Sep 17 00:00:00 2001
From: randx <dmitriy.zaporozhets@gmail.com>
Date: Tue, 16 Oct 2012 09:43:22 +0300
Subject: [PATCH] Fix plain text readme

---
 app/assets/stylesheets/common.scss | 8 ++++++++
 app/helpers/tree_helper.rb         | 4 ++++
 app/views/tree/_readme.html.haml   | 5 ++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 46de2cf3f7..8ebbb53b96 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -662,3 +662,11 @@ li.note {
   }
 }
 
+pre {
+  &.clean {
+    background:none;
+    border:none;
+    margin:0;
+    padding:0;
+  }
+}
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 65c2379917..c681dc607a 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -51,6 +51,10 @@ module TreeHelper
     filename.end_with?(*%w(.mdown .md .markdown))
   end
 
+  def plain_text_readme? filename
+    filename == 'README'
+  end
+
   # Simple shortcut to File.join
   def tree_join(*args)
     File.join(*args)
diff --git a/app/views/tree/_readme.html.haml b/app/views/tree/_readme.html.haml
index 4e5f4b403c..e9bb112745 100644
--- a/app/views/tree/_readme.html.haml
+++ b/app/views/tree/_readme.html.haml
@@ -6,5 +6,8 @@
     - if gitlab_markdown?(readme.name)
       = preserve do
         = markdown(readme.data)
+    - elsif plain_text_readme?(readme.name)
+      %pre.clean
+        = readme.data
     - else
-      = raw GitHub::Markup.render(readme.name, readme.data)
\ No newline at end of file
+      = raw GitHub::Markup.render(readme.name, readme.data)
-- 
2.30.9