You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/11/27 14:46:06 UTC
[16/44] git commit: [#5245] convert tabs to spaces,
so they can be escaped and not turn into code blocks
[#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/cj/4691
Commit: 8c76fc1ab0756532df660b7e0ba1b7d5aee59f58
Parents: d688059
Author: Dave Brondsema <db...@geek.net>
Authored: Mon Nov 12 23:00:48 2012 +0000
Committer: Dave Brondsema <db...@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('&', text)
# avoid accidental 4-space indentations creating code blocks
if preserve_multiple_spaces:
+ text = text.replace('\t', ' ' * 4)
text = re_preserve_spaces.sub(' ', 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 bar\n\n code here?')
+
+ assert_equal(rssfeeds.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
+ ' tab before \(stuff\)')
\ No newline at end of file