blob: 125baa4c1fbe6113172fd4de2ea62fe78c9ab605 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
import re
import fluent.syntax.ast as FTL
from fluent.migrate.transforms import TransformPattern
class STRIP_LABEL(TransformPattern):
# Used to remove `<label data-l10n-name="remove-search-engine-article">` from a string
def visit_TextElement(self, node):
node.value = re.sub(
'\s?<label data-l10n-name="remove-search-engine-article">.+?</label>\s?',
"",
node.value,
)
return node
def migrate(ctx):
"""Bug 1845150 - Use moz-message-bar instead of message-bar in notificationbox.js, part {index}."""
search_ftl = "browser/browser/search.ftl"
ctx.add_transforms(
search_ftl,
search_ftl,
[
FTL.Message(
id=FTL.Identifier("removed-search-engine-message2"),
value=STRIP_LABEL(search_ftl, "removed-search-engine-message"),
),
],
)
|