incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [01/43] git commit: [#6622] ticket:435 convert github markup
Date Thu, 14 Nov 2013 17:36:22 GMT
Updated Branches:
  refs/heads/cj/6836 837903c4a -> ce517aa65 (forced update)


[#6622] ticket:435  convert github markup


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

Branch: refs/heads/cj/6836
Commit: 18b4e34e9e5893ed7b92719442bc143faf7f49ce
Parents: a4e46b7
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Thu Oct 10 12:10:34 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Nov 13 17:16:54 2013 +0000

----------------------------------------------------------------------
 .../forgeimporters/github/tests/test_wiki.py    | 36 ++++++++++++++++++++
 ForgeImporters/forgeimporters/github/wiki.py    |  4 ++-
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/18b4e34e/ForgeImporters/forgeimporters/github/tests/test_wiki.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tests/test_wiki.py b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
index 50c905d..bb2a383 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -479,6 +479,42 @@ some text and **[Tips n' Tricks]**
         result = u'<p><strong>[[this checklist|Troubleshooting]]</strong></p>'
         assert_equal(f(source, 't.textile').strip(), result)
 
+    def test_convert_sha_github_markup(self):
+        html = 'SHA: 16c999e8c71134401a78d4d46435517b2271d6ac'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'SHA: [16c999]')
+
+    def test_convert_user_sha_github_markup(self):
+        html = 'User@SHA: mojombo@16c999e8c71134401a78d4d46435517b2271d6ac'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'User@SHA:[16c999]')
+
+    def test_convert_user_repo_sha_github_markup(self):
+        html = 'User/Repository@SHA: mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'User/Repository@SHA: [16c999]')
+
+    def test_convert_ticket_github_markup(self):
+        html = 'Ticket: #1'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'Ticket: [#1]')
+
+    def test_convert_username_ticket_github_markup(self):
+        html = 'User#Num: user#1'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'User#Num: [#1]')
+
+    def test_convert_username_repo_ticket_github_markup(self):
+        html = 'User/Repository#Num: user/repo#1'
+        importer = GitHubWikiImporter()
+        result = importer.convert_github_markup(html)
+        assert_equal(result, 'User/Repository#Num: [#1]')
+
 
 class TestGitHubWikiImportController(TestController, TestCase):
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/18b4e34e/ForgeImporters/forgeimporters/github/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/wiki.py b/ForgeImporters/forgeimporters/github/wiki.py
index fff43ad..f95ba44 100644
--- a/ForgeImporters/forgeimporters/github/wiki.py
+++ b/ForgeImporters/forgeimporters/github/wiki.py
@@ -264,7 +264,7 @@ class GitHubWikiImporter(ToolImporter):
         """
         name, ext = os.path.splitext(filename)
         if ext in self.markdown_exts:
-            return text
+            return self.convert_github_markup(text)
 
         try:
             import html2text
@@ -394,6 +394,7 @@ class GitHubWikiImporter(ToolImporter):
                     a.setString(new_prefix + new_page)
         return unicode(soup)
 
+
     def _prepare_textile_text(self, text):
         # need to convert lists properly
         text_lines = text.splitlines()
@@ -406,3 +407,4 @@ class GitHubWikiImporter(ToolImporter):
         # so these tags will not be affected by converter
         text = text.replace('[[', '<notextile>[[').replace(']]', ']]</notextile>')
         return text
+


Mime
View raw message