Skip to content

Commit

Permalink
clean <blockquote>s of less than 50 words (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
JJMC89 committed Apr 10, 2024
1 parent 9921932 commit 04072f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/copypatrol_backend/check_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def clean_wikitext(text: str, /, *, site: APISite) -> str:
for param in keep_params:
with suppress(ValueError):
tpl.remove(param)
# remove references of less than 50 words
for tag in wikicode.ifilter_tags():
if tag.tag.lower() not in ("ref", "references"):
continue
# remove block quotes and references of less than 50 words
for tag in wikicode.ifilter_tags(
matches=lambda x: x.tag.lower() in ("blockquote", "ref", "references"),
):
contents = tag.contents.strip_code(keep_template_params=True).strip()
if len(contents.split(" ")) < 50:
with suppress(ValueError):
Expand Down

0 comments on commit 04072f5

Please sign in to comment.