incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [42/44] git commit: [#6534] ticket:449 Allow & in gollum page links
Date Fri, 04 Oct 2013 14:43:30 GMT
[#6534] ticket:449 Allow & in gollum page links


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

Branch: refs/heads/master
Commit: 6b19c55c83a2db394b73965bb513ffd62ea1d71f
Parents: 1083aa8
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Oct 1 12:20:29 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Oct 4 14:21:25 2013 +0000

----------------------------------------------------------------------
 .../forgeimporters/github/tests/test_wiki.py    | 20 ++++++++++++++++----
 ForgeImporters/forgeimporters/github/wiki.py    |  1 +
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6b19c55c/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 9a78fa9..fd3e74f 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -248,7 +248,7 @@ Our website is [[http://sf.net]].
         # markdown should be untouched
         assert_equal(f(source, 'test.md'), source)
 
-        assert_equal(f(u'h1. Hello', 't.textile'), u'# Hello\n\n')
+        assert_equal(f(u'h1. Hello', 't.textile').strip(), u'# Hello')
 
     @without_module('html2text')
     def test_convert_markup_without_html2text(self):
@@ -269,14 +269,14 @@ Our website is [[http://sf.net]].
 
 [External link](https://github.com/a/b/issues/1)'''
 
-        result = u''' <p>Look at [[this page|Some Page]]</p>
+        result = u'''<p>Look at [[this page|Some Page]]</p>
 <p>More info at: [[MoreInfo]] [[Even More Info]]</p>
 <p>Our website is [[http://sf.net]].</p>
 <p>'[[Escaped Tag]]</p>
 <p>[External link to the wiki page](https://github.com/a/b/wiki/Page)</p>
 <p>[External link](https://github.com/a/b/issues/1)</p>'''
 
-        assert_equal(f(source, 'test.textile'), result)
+        assert_equal(f(source, 'test.textile').strip(), result)
 
     def test_rewrite_links(self):
         f = GitHubWikiImporter().rewrite_links
@@ -342,7 +342,19 @@ Some text 1.
 ## Header 2
 
 See [Page]'''
-        assert_equal(f(source, 'test.textile').rstrip('\n\n'), result)
+        assert_equal(f(source, 'test.textile').strip(), result)
+
+    @skipif(module_not_available('html2text'))
+    def test_convert_markup_with_amp_in_links(self):
+        importer = GitHubWikiImporter()
+        importer.github_wiki_url = 'https://github.com/a/b/wiki'
+        importer.app = Mock()
+        importer.app.url = '/p/test/wiki/'
+        f = importer.convert_markup
+        source = u'[[Ticks & Leeches]]'
+        result = u'[Ticks & Leeches]'
+        # markdown should be untouched
+        assert_equal(f(source, 'test.textile').strip(), result)
 
 
 class TestGitHubWikiImportController(TestController, TestCase):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6b19c55c/ForgeImporters/forgeimporters/github/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/wiki.py b/ForgeImporters/forgeimporters/github/wiki.py
index 653fcb6..b041cec 100644
--- a/ForgeImporters/forgeimporters/github/wiki.py
+++ b/ForgeImporters/forgeimporters/github/wiki.py
@@ -311,6 +311,7 @@ class GitHubWikiImporter(ToolImporter):
 
     def _gollum_page_link(self, link, title, options):
         page = self._convert_page_name(link)
+        page = page.replace(u'&amp;', u'&')  # allow & in page links
         if title:
             return u'[{}]({})'.format(title, page)
         return u'[{}]'.format(page)


Mime
View raw message