Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Remove html tags
Browse files Browse the repository at this point in the history
  • Loading branch information
inacionery authored and brianchandotcom committed Jan 5, 2021
1 parent 61cea55 commit 67a501a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions git-pull-request/git-pull-request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,8 @@ def display_pull_request(pull_request):

pr_body = "\n".join(pr_body)

pr_body = strip_html_tags(pr_body)

print strip_empty_lines(pr_body)

print
Expand Down Expand Up @@ -1933,6 +1935,24 @@ def strip_empty_lines(text):
return "\n".join(lines)


def strip_html_tags(html_raw):
tag = False
quote = False
html = ""

for line in html_raw:
if line == '<' and not quote:
tag = True
elif line == '>' and not quote:
tag = False
elif (line == '"' or line == "'") and tag:
quote = not quote
elif not tag:
html += line

return html


def update_branch(branch_name):
if in_work_dir():
raise UserWarning(
Expand Down

0 comments on commit 67a501a

Please sign in to comment.