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

Commit

Permalink
Always strip html
Browse files Browse the repository at this point in the history
  • Loading branch information
inacionery committed Jan 5, 2021
1 parent 8ce4bc1 commit b245097
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions git-pull-request/git-pull-request.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@
"close-default-comment": None,
# Set the indent character(s) used to indent the description
"description-indent": " ",
# Set to true to remove the CI comments from the description of the pull
"description-strip-CI": True,
# Set to true to remove the newlines from the description of the pull
# (this will format it as it used to)
"description-strip-newlines": False,
Expand Down Expand Up @@ -1037,6 +1035,8 @@ def display_pull_request(pull_request):
pr_body = pull_request.get("body")

if pr_body and pr_body.strip():
pr_body = strip_html_tags(pr_body)

pr_body = re.sub("(<br\s?/?>)", "\n", pr_body.strip())

if options["description-strip-newlines"]:
Expand Down Expand Up @@ -1064,10 +1064,6 @@ def display_pull_request(pull_request):

pr_body = "\n".join(pr_body)

if options["description-strip-CI"]:
pr_body = re.sub("<h3><g-emoji([\s\S]*?)</h5></details>", "", pr_body)

pr_body = strip_html_tags(pr_body)

print strip_empty_lines(pr_body)

Expand Down Expand Up @@ -1908,11 +1904,11 @@ def strip_empty_lines(text):


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

for line in html_raw:
for line in re.sub("<html>([\s\S]*?)</html>", "", html_raw):
if line == '<' and not quote:
tag = True
elif line == '>' and not quote:
Expand Down

0 comments on commit b245097

Please sign in to comment.