You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/15 17:55:33 UTC

[1/3] git commit: [#5634] ticket:333 fixed html comments in markdown

Updated Branches:
  refs/heads/master 5f41cdae2 -> 78e97ac49


[#5634]  ticket:333 fixed  html comments in markdown


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

Branch: refs/heads/master
Commit: 922432431f2f3abf72d1ce20613397ba07367954
Parents: 5f41cda
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed May 8 13:56:12 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 15:44:03 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/markdown_extensions.py |    2 +-
 Allura/allura/tests/test_globals.py      |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/92243243/Allura/allura/lib/markdown_extensions.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py
index 942e944..62b7fe9 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -252,7 +252,7 @@ class RelativeLinkRewriter(markdown.postprocessors.Postprocessor):
             rewrite(link, 'href')
         for link in soup.findAll('img'):
             rewrite(link, 'src')
-        return unicode(soup)
+        return unicode(str(soup), "utf-8" )
 
     def _rewrite(self, tag, attr):
         val = tag.get(attr)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/92243243/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index bf17979..71629ed 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -282,6 +282,10 @@ def test_markdown_within_html():
 <p><strong>blah</strong></p>
 </div>''' in r, r
 
+def test_markdown_with_html_comments():
+    text = g.markdown.convert('test <!-- comment -->')
+    assert '<div class="markdown_content"><p>test <!-- comment --></p></div>' == text, text
+
 
 def test_markdown_big_text():
     '''If text is too big g.markdown.convert should return plain text'''


[3/3] git commit: use correct comment syntax in README.markdown

Posted by br...@apache.org.
use correct comment syntax in README.markdown


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

Branch: refs/heads/master
Commit: 78e97ac49d2d5e3b5cc4bcb2284839d648c9aa3a
Parents: fcd3b58
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed May 15 15:49:57 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 15:49:57 2013 +0000

----------------------------------------------------------------------
 README.markdown |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/78e97ac4/README.markdown
----------------------------------------------------------------------
diff --git a/README.markdown b/README.markdown
index 0bf5187..4284960 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1,19 +1,21 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
 
 # Sandbox Creation
 


[2/3] git commit: [#5634] ticket:333 Use h.really_unicode and add comments

Posted by br...@apache.org.
[#5634] ticket:333 Use h.really_unicode and add comments


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

Branch: refs/heads/master
Commit: fcd3b5876e810c4d269daf0844d848b420b04237
Parents: 9224324
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed May 8 14:10:17 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 15:44:04 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/markdown_extensions.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fcd3b587/Allura/allura/lib/markdown_extensions.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py
index 62b7fe9..a1158e5 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -252,7 +252,15 @@ class RelativeLinkRewriter(markdown.postprocessors.Postprocessor):
             rewrite(link, 'href')
         for link in soup.findAll('img'):
             rewrite(link, 'src')
-        return unicode(str(soup), "utf-8" )
+        # BeautifulSoup always stores data in unicode,
+        # but when doing unicode(soup) it does some strange things
+        # like nesting html comments, e.g. returns <!--<!-- comment -->-->
+        # instead of <!-- comment -->.
+        # Converting soup object to string representation first,
+        # and then back to unicode avoids that.
+        # str() called on BeautifulSoup document always returns string
+        # encoded in utf-8, so this should always work.
+        return h.really_unicode(str(soup))
 
     def _rewrite(self, tag, attr):
         val = tag.get(attr)