incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [11/21] git commit: [#6622] ticket:435 Fix code block regex
Date Wed, 13 Nov 2013 17:19:30 GMT
[#6622] ticket:435 Fix code block regex


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

Branch: refs/heads/master
Commit: 88365c69c23f5351d944f39e0c3859bd1cfe84c7
Parents: d7ee191
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Oct 14 16:33:15 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Nov 13 17:16:56 2013 +0000

----------------------------------------------------------------------
 .../forgeimporters/github/tests/test_utils.py   | 20 +++++++++++++++++++-
 ForgeImporters/forgeimporters/github/utils.py   |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88365c69/ForgeImporters/forgeimporters/github/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tests/test_utils.py b/ForgeImporters/forgeimporters/github/tests/test_utils.py
index 3ce8d29..e3ba75c 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_utils.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_utils.py
@@ -76,6 +76,24 @@ class TestGitHubMarkdownConverter(object):
     def test_convert_code_blocks(self):
         text = u'''```python
 print "Hello!"
+```
+
+Two code blocks here!
+
+```
+for (var i = 0; i < a.length; i++) {
+    console.log(i);
+}
 ```'''
-        result = u'~~~~\nprint "Hello!"\n~~~~'
+        result = u'''~~~~
+print "Hello!"
+~~~~
+
+Two code blocks here!
+
+~~~~
+for (var i = 0; i < a.length; i++) {
+    console.log(i);
+}
+~~~~'''
         assert_equal(self.conv.convert(text).strip(), result)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88365c69/ForgeImporters/forgeimporters/github/utils.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/utils.py b/ForgeImporters/forgeimporters/github/utils.py
index da50c2d..f00140d 100644
--- a/ForgeImporters/forgeimporters/github/utils.py
+++ b/ForgeImporters/forgeimporters/github/utils.py
@@ -30,7 +30,7 @@ class GitHubMarkdownConverter(object):
         _re = re.compile(r'~~(.*)~~',)
         text = _re.sub(self._convert_strikethrough, text)
 
-        _re = re.compile(r'```\w*(.*)```', re.DOTALL)
+        _re = re.compile(r'```\w*(.*?)```', re.DOTALL)
         text = _re.sub(self._convert_codeblock, text)
         return text
 


Mime
View raw message