incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#5245] convert tabs to spaces, so they can be escaped and not turn into code blocks
Date Mon, 12 Nov 2012 23:00:57 GMT
Updated Branches:
  refs/heads/db/5245 d68805919 -> 8c76fc1ab


[#5245] convert tabs to spaces, so they can be escaped and not turn into code blocks


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

Branch: refs/heads/db/5245
Commit: 8c76fc1ab0756532df660b7e0ba1b7d5aee59f58
Parents: d688059
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Nov 12 23:00:48 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Nov 12 23:00:48 2012 +0000

----------------------------------------------------------------------
 ForgeBlog/forgeblog/command/rssfeeds.py    |    1 +
 ForgeBlog/forgeblog/tests/test_commands.py |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8c76fc1a/ForgeBlog/forgeblog/command/rssfeeds.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/command/rssfeeds.py b/ForgeBlog/forgeblog/command/rssfeeds.py
index d213945..abbc346 100644
--- a/ForgeBlog/forgeblog/command/rssfeeds.py
+++ b/ForgeBlog/forgeblog/command/rssfeeds.py
@@ -44,6 +44,7 @@ def plain2markdown(text, preserve_multiple_spaces=False, has_html_entities=False
         text = re_amp.sub('&amp;', text)
     # avoid accidental 4-space indentations creating code blocks
     if preserve_multiple_spaces:
+        text = text.replace('\t', ' ' * 4)
         text = re_preserve_spaces.sub('&nbsp;', text)
     else:
         text = re_leading_spaces.sub('', text)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8c76fc1a/ForgeBlog/forgeblog/tests/test_commands.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/test_commands.py b/ForgeBlog/forgeblog/tests/test_commands.py
index 15c054f..6b4b44c 100644
--- a/ForgeBlog/forgeblog/tests/test_commands.py
+++ b/ForgeBlog/forgeblog/tests/test_commands.py
@@ -173,3 +173,6 @@ http://blah.com/?x=y&a=b - not escaped either
 
     assert_equal(rssfeeds.plain2markdown('a foo  bar\n\n    code here?', preserve_multiple_spaces=True),
                 'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
+
+    assert_equal(rssfeeds.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
+                 '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
\ No newline at end of file


Mime
View raw message