component email message: Mailing list messages cleaning:

For mailing-list messages:
    - convert all text-only messages to XHTML for consistency.
    - detect and flag "noisy" content, i.e. content which are not useful and annoying in
      forum-like view (full-lenght quoted previous messages, mailing-list signature)

rel 464
This commit is contained in:
Goffi 2025-09-11 21:17:47 +02:00
commit 63edb309f8

View file

@ -195,16 +195,19 @@ SAFE_CLASSES = {
"vm",
"w",
"write",
# "noise" class is used by gateways (in particular email gateway) to mark annoying and
# not useful content.
"noise"
}
STYLES_VALUES_REGEX = (
r"^("
"^("
+ "|".join(
[
"([a-z-]+)", # alphabetical names
"(#[0-9a-f]+)", # hex value
"(\d+(.\d+)? *(|%|em|ex|px|in|cm|mm|pt|pc))", # values with units (or not)
"rgb\( *((\d+(.\d+)?), *){2}(\d+(.\d+)?) *\)", # rgb function
"rgba\( *((\d+(.\d+)?), *){3}(\d+(.\d+)?) *\)", # rgba function
r"([a-z-]+)", # alphabetical names
r"(#[0-9a-f]+)", # hex value
r"(\d+(.\d+)? *(|%|em|ex|px|in|cm|mm|pt|pc))", # values with units (or not)
r"rgb\( *((\d+(.\d+)?), *){2}(\d+(.\d+)?) *\)", # rgb function
r"rgba\( *((\d+(.\d+)?), *){3}(\d+(.\d+)?) *\)", # rgba function
]
)
+ ") *(!important)?$"