Skip to content

Commit

Permalink
Indent the command that starts a heredoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jesselang committed Oct 23, 2017
1 parent cafa844 commit 554c66d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions beautysh/beautysh.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,20 @@ def beautify_string(self, data, path=''):
test_record = re.sub(r'\\.', '', test_record)
# remove '#' comments
test_record = re.sub(r'(\A|\s)(#.*)', '', test_record, 1)
if(not in_here_doc):
if(re.search(r'<<-?', test_record)):
here_string = re.sub(
r'.*<<-?\s*[\'|"]?([_|\w]+)[\'|"]?.*', r'\1',
stripped_record, 1)
in_here_doc = (len(here_string) > 0)

if(in_here_doc): # pass on with no changes
output.append(record)
# now test for here-doc termination string
if(re.search(here_string, test_record) and not
re.search(r'<<', test_record)):
in_here_doc = False
else: # not in here doc
if(re.search(r'<<-?', test_record)):
here_string = re.sub(
r'.*<<-?\s*[\'|"]?([_|\w]+)[\'|"]?.*', r'\1',
stripped_record, 1)
in_here_doc = (len(here_string) > 0)

if(in_ext_quote):
if(re.search(ext_quote_string, test_record)):
# provide line after quotes
Expand Down

0 comments on commit 554c66d

Please sign in to comment.