Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter unsubscribe emails #1558

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion script/rss2html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ let delete_author title =
(* Remove the "[Caml-list]" and possible "Re:". *)
let caml_list_re =
Str.regexp_case_fold "^\\(Re: *\\)*\\(\\[[a-zA-Z0-9-]+\\] *\\)*"

let unsubscribe_email_re= Str.regexp_case_fold ".*unsubscribe.*"
Copy link

@gs0510 gs0510 Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a newline before and after unsubscribe_email_re? Thanks! :))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did. :)

(** [email_threads] does basically the same as [headlines] but filter
the posts to have repeated subjects. It also presents the subject
better. *)
Expand All @@ -609,6 +609,7 @@ let email_threads ?n ~l9n url =
let must_keep (e: Atom.entry) =
let title = string_of_text_construct e.Atom.title in
if S.mem title !seen then false
else if Str.string_match unsubscribe_email_re title 0 then false
else (seen := S.add title !seen; true) in
let posts = List.filter must_keep posts in
let posts = (match n with
Expand Down