Skip to content

Commit

Permalink
Remove undocumented .strip() from join_lines()
Browse files Browse the repository at this point in the history
Why I noticed this: It has the potential to eat significant white
space in usage messages that are marked up in reStructuredText syntax.

Why I decided to change it: The behavior isn't documented and on
second thought I wouldn't expect a function called join_lines()
to strip any and all leading/trailing white space.
  • Loading branch information
xolox committed Apr 21, 2016
1 parent 55d2e27 commit 1df92d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions humanfriendly/__init__.py
@@ -1,7 +1,7 @@
# Human friendly input/output in Python.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: March 20, 2016
# Last Change: April 21, 2016
# URL: https://humanfriendly.readthedocs.org

"""The main module of the `humanfriendly` package."""
Expand Down Expand Up @@ -37,7 +37,7 @@
from humanfriendly.compat import is_string

# Semi-standard module versioning.
__version__ = '1.44.5'
__version__ = '1.44.6'

# Spinners are redrawn at most this many seconds.
minimum_spinner_interval = 0.2
Expand Down
4 changes: 2 additions & 2 deletions humanfriendly/text.py
@@ -1,7 +1,7 @@
# Human friendly input/output in Python.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: October 22, 2015
# Last Change: April 21, 2016
# URL: https://humanfriendly.readthedocs.org

"""
Expand Down Expand Up @@ -240,7 +240,7 @@ def join_lines(text):
break :func:`join_lines()` (in that case you can use :func:`dedent()`
before calling :func:`join_lines()`).
"""
return re.sub(r'(\S)\n(\S)', r'\1 \2', text).strip()
return re.sub(r'(\S)\n(\S)', r'\1 \2', text)


def pluralize(count, singular, plural=None):
Expand Down
4 changes: 2 additions & 2 deletions humanfriendly/usage.py
@@ -1,7 +1,7 @@
# Human friendly input/output in Python.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: March 20, 2016
# Last Change: April 21, 2016
# URL: https://humanfriendly.readthedocs.org

"""
Expand Down Expand Up @@ -307,7 +307,7 @@ def render_paragraph(paragraph, meta_variables):
if paragraph == 'Supported options:':
return "**%s**" % paragraph
# Reformat shell transcripts into code blocks.
if re.match(r'^\$\s+\S', paragraph):
if re.match(r'^\s*\$\s+\S', paragraph):
lines = [' %s' % line for line in paragraph.splitlines()]
lines.insert(0, '.. code-block:: sh')
lines.insert(1, '')
Expand Down

0 comments on commit 1df92d7

Please sign in to comment.