allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/2] git commit: [#6796] ticket:470 Render markdown files in repos
Date Tue, 05 Nov 2013 22:39:25 GMT
[#6796] ticket:470 Render markdown files in repos


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/112cbf7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/112cbf7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/112cbf7c

Branch: refs/heads/master
Commit: 112cbf7c0b8884e3553cfb8827506b3d46bedd9f
Parents: 49f2e8d
Author: Yaroslav Sokolovsky <yaroslav.sokolovsky@gmail.com>
Authored: Fri Nov 1 18:43:17 2013 +0200
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Nov 5 22:39:16 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py           | 4 +++-
 Allura/allura/tests/unit/test_repo.py | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/112cbf7c/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index b11e20e..b598e20 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -54,6 +54,7 @@ README_RE = re.compile('^README(\.[^.]*)?$', re.IGNORECASE)
 VIEWABLE_EXTENSIONS = ['.php','.py','.js','.java','.html','.htm','.yaml','.sh',
     '.rb','.phtml','.txt','.bat','.ps1','.xhtml','.css','.cfm','.jsp','.jspx',
     '.pl','.php4','.php3','.rhtml','.svg','.markdown','.json','.ini','.tcl','.vbs','.xsl']
+MARKDOWN_EXTENSIONS = ['.markdown', '.mdown', '.mkdn', '.mkd', '.md', '.rst']
 
 DIFF_SIMILARITY_THRESHOLD = .5  # used for determining file renames
 
@@ -724,7 +725,7 @@ class Blob(object):
 
     @property
     def has_pypeline_view(self):
-        if README_RE.match(self.name) or self.extension in ['.md', '.rst']:
+        if README_RE.match(self.name) or self.extension in MARKDOWN_EXTENSIONS:
             return True
         return False
 
@@ -732,6 +733,7 @@ class Blob(object):
     def has_html_view(self):
         if (self.content_type.startswith('text/') or
             self.extension in VIEWABLE_EXTENSIONS or
+            self.extension in MARKDOWN_EXTENSIONS or
             self.extension in self.repo._additional_viewable_extensions or
             utils.is_text_file(self.text)):
             return True

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/112cbf7c/Allura/allura/tests/unit/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_repo.py b/Allura/allura/tests/unit/test_repo.py
index ad956b5..8c104fa 100644
--- a/Allura/allura/tests/unit/test_repo.py
+++ b/Allura/allura/tests/unit/test_repo.py
@@ -198,6 +198,14 @@ class TestBlob(unittest.TestCase):
         _next.get_path.assert_called_with('path', create=False)
         assert_equal(nc, _next)
 
+    def test_pypeline_view(self):
+        blob = M.repo.Blob(Mock(), Mock(), Mock())
+        blob._id = 'blob1'
+        blob.path = Mock(return_value='path')
+        blob.name = 'INSTALL.mdown'
+        blob.extension = '.mdown'
+        assert_equal(blob.has_pypeline_view, True)
+
 
 class TestCommit(unittest.TestCase):
     def test_get_path_no_create(self):


Mime
View raw message