incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [25/50] git commit: [#6534] ticket:450 Always strip out <notextile> tag
Date Wed, 23 Oct 2013 12:57:02 GMT
[#6534] ticket:450 Always strip out <notextile> tag


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

Branch: refs/heads/tv/6610
Commit: 7b022840b26f3fcdd6dd1be6b2f30c26a48ba24f
Parents: dbd6634
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Oct 11 09:29:31 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Oct 15 21:27:53 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7b022840/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 023622c..50c905d 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -458,7 +458,7 @@ some text and **[Tips n' Tricks]**
 '''
         assert_equal(f(source, 'test3.textile'), result)
 
-
+    @skipif(module_not_available('html2text'))
     def test_convert_textile_special_tag(self):
         importer = GitHubWikiImporter()
         importer.github_wiki_url = 'https://github.com/a/b/wiki'
@@ -466,8 +466,18 @@ some text and **[Tips n' Tricks]**
         importer.app.url = '/p/test/wiki/'
         f = importer.convert_markup
         source = u'*[[this checklist|Troubleshooting]]*'
-        assert_not_in('<notextile>', f(source, 'test3.textile'))
-        assert_not_in('&#60;notextile&#62;', f(source, 'test3.textile'))
+        assert_equal(f(source, 't.textile').strip(), u'**[this checklist](Troubleshooting)**')
+
+    @without_module('html2text')
+    def test_convert_textile_special_tag_without_html2text(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'*[[this checklist|Troubleshooting]]*'
+        result = u'<p><strong>[[this checklist|Troubleshooting]]</strong></p>'
+        assert_equal(f(source, 't.textile').strip(), result)
 
 
 class TestGitHubWikiImportController(TestController, TestCase):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7b022840/ForgeImporters/forgeimporters/github/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/wiki.py b/ForgeImporters/forgeimporters/github/wiki.py
index a5989db..d24b27f 100644
--- a/ForgeImporters/forgeimporters/github/wiki.py
+++ b/ForgeImporters/forgeimporters/github/wiki.py
@@ -285,9 +285,9 @@ class GitHubWikiImporter(ToolImporter):
             if html2text:
                 text = html2text.html2text(text)
                 text = self.convert_gollum_tags(text)
-                text = text.replace('<notextile>', '').replace('</notextile>',
'')
-            else:
-                text = text.replace('&#60;notextile&#62;', '').replace('&#60;/notextile&#62;',
'')
+            text = text.replace('<notextile>', '').replace('</notextile>', '')
+            text = text.replace('&#60;notextile&#62;', '').replace('&#60;/notextile&#62;',
'')
+            text = text.replace('&lt;notextile&gt;', '').replace('&lt;/notextile&gt;',
'')
             return text
         else:
             text = h.render_any_markup(filename, text)


Mime
View raw message