incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [18/36] git commit: [#6534] ticket:441 Convert gollum tags
Date Fri, 27 Sep 2013 16:43:23 GMT
[#6534] ticket:441 Convert gollum tags


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

Branch: refs/heads/db/6534
Commit: 43c41d572a0ba1213a00ee794ba4be55bf82af53
Parents: 4082120
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Sep 18 16:20:10 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 27 16:40:23 2013 +0000

----------------------------------------------------------------------
 .../forgeimporters/github/tests/test_wiki.py    | 24 ++++++++++++++++----
 ForgeImporters/forgeimporters/github/wiki.py    |  6 +++++
 2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43c41d57/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 d7f8196..4f29842 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -124,9 +124,6 @@ class TestGitHubWikiImporter(TestCase):
         assert_equal(upsert.call_args_list, [call('Home')])
         assert_equal(render.call_args_list, [call('Home.md', u'# test message')])
 
-    def test_convert_gollum_tags(self):
-        pass
-
     def test_convert_gollum_page_links(self):
         f = GitHubWikiImporter().convert_gollum_page_links
         assert_equal(f(u'[[Page]]'), u'[Page]')
@@ -165,8 +162,25 @@ class TestGitHubWikiImporter(TestCase):
         assert_equal(f(u"'[[https://sf.net]]"), u'[[https://sf.net]]')
         assert_equal(f(u"'[[SourceForge|http://sf.net]]"), u'[[SourceForge|http://sf.net]]')
 
-    def test_convert_gollum_toc(self):
-        pass
+    def test_convert_gollum_tags(self):
+        f = GitHubWikiImporter().convert_gollum_tags
+        source = u'''Look at [[this page|Some Page]]
+
+More info at: [[MoreInfo]] [[Even More Info]]
+
+Our website is [[http://sf.net]].
+
+'[[Escaped Tag]]'''
+
+        result = u'''Look at [this page](Some Page)
+
+More info at: [MoreInfo] [Even More Info]
+
+Our website is <http://sf.net>.
+
+[[Escaped Tag]]'''
+
+        assert_equal(f(source), result)
 
 
 class TestGitHubWikiImportController(TestController, TestCase):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43c41d57/ForgeImporters/forgeimporters/github/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/wiki.py b/ForgeImporters/forgeimporters/github/wiki.py
index bfc4b21..a05b954 100644
--- a/ForgeImporters/forgeimporters/github/wiki.py
+++ b/ForgeImporters/forgeimporters/github/wiki.py
@@ -204,6 +204,12 @@ class GitHubWikiImporter(ToolImporter):
             self.get_blobs_with_history(commit)
         rmtree(wiki_path)
 
+    def convert_gollum_tags(self, text):
+        # order is important
+        text = self.convert_gollum_external_links(text)
+        text = self.convert_gollum_page_links(text)
+        return text
+
     def convert_gollum_page_links(self, text):
         _re = re.compile(r'''(?P<quote>')?            # possible tag escaping
                              (?P<tag>\[\[             # tag start


Mime
View raw message